Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Dawn Susee](https://secure.gravatar.com/avatar/f272033d14582271c8f3dd141b781b28?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Dawn Susee
11,830 PointsError with srcCompat
I am getting the following error when trying to run the Interactive Story app:
Error:(11) No resource identifier found for attribute 'srcCompat' in package 'com.hylapad.interactivestory'
Here is my code for my XML file
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.hylapad.interactivestory.MainActivity">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:srcCompat="@drawable/main_title"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:id="@+id/titleImageView"
android:scaleType="fitXY"
android:adjustViewBounds="true"
android:contentDescription="Signals from Mars"/>
</RelativeLayout>
Here is the code for my Gradle file:
apply plugin: 'com.android.application'
android { compileSdkVersion 22 buildToolsVersion "24.0.3" defaultConfig { applicationId "com.hylapad.interactivestory" minSdkVersion 14 targetSdkVersion 22 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } }
dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) compile 'com.android.support:appcompat-v7:22.2.1' testCompile 'junit:junit:4.12' }
1 Answer
![Seth Kroger](https://secure.gravatar.com/avatar/b5bdc43c1e576145fb404edba6fea5a6?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Seth Kroger
56,413 Pointsapp:srcCompat
was added in the support libraries in 23.2, but you're using the 22.2 version. You can either update that in build,.gradle or use the older android:src
property since this project doesn't use vector drawables.
http://android-developers.blogspot.com/2016/02/android-support-library-232.html
Dawn Susee
11,830 PointsDawn Susee
11,830 PointsThank you! The app runs now without error.