After updating android support library 23.2.0
to 23.2.1
there is an error of R.drawable.abc_ic_ab_back_material
not found.
What is the updated resource used in version 23.2.1
?
After researching some time I found that in version 23.2.1
google again introduced the drawable R.drawable.abc_ic_ab_back_mtrl_am_alpha
which is removed in 23.2.0
.
So, changing to R.drawable.abc_ic_ab_back_mtrl_am_alpha
from R.drawable.abc_ic_ab_back_material
solve my problem.
1- Use R.drawable.abc_ic_ab_back_material
instead of R.drawable.abc_ic_ab_back_mtrl_am_alpha
2- in your build.gradle add the bellow value:
// Gradle Plugin 2.0+
android {
defaultConfig {
vectorDrawables.useSupportLibrary = true
}
}
3- Use "srcCompat" attr instead of "src" in all xml:
<ImageButton xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/back_button_bar"
app:srcCompat="@drawable/abc_ic_ab_back_material"/>
don't forget to use another attr resource like this xmlns:app="http://schemas.android.com/apk/res-auto"
4- Add next line in your application class
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
5- Google recomend copy the R.drawable.abc_ic_ab_back_material and paste in your project.
source: https://android-developers.googleblog.com/2016/02/android-support-library-232.html
I had the same problem with my vector drawables. I used image vector drawable importer tool of Android Studio. it makes the object in
res>anydpi>myobject.xml
The problem solved by copying the drawable into
res>drawable
Folder.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With