I am getting Error:(26) No resource identifier found for attribute \'srcCompat\' in package \'learnapp.android.example.com.learnapp\'
when I try to run my app.I
I just changed
xmlns:app="http://schemas.android.com/apk/res-auto"
to
xmlns:app="http://schemas.android.com/apk/lib/my_package_name"
I saw the answer here
I'm using the srcCompat api as follows.
<android.support.v7.widget.AppCompatImageView
android:id="@+id/dashboard"
android:layout_width="60dp"
android:layout_height="60dp"
srcCompat="@drawable/dash">
More info
Happens if you start updating Android Studio and canceled the update midway complete the update process and everything should be back to normal
Also happens when you have outdated versions of the support libraries.
I updated from:
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
to:
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.android.support:recyclerview-v7:24.2.1'
(those were the newest versions at the moment I wrote this)
and the error is gone.
change app:srcCompat="@android:drawable/ic_dialog_email"
for
android:src="@android:drawable/ic_dialog_email"
Add this vectorDrawables.useSupportLibrary = true
to your app level build.gradle
defaultConfig {
...
targetSdkVersion 23
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
}