abc_ic_ab_back_material resource not found in support library 23.2.1

五迷三道 提交于 2019-12-10 12:44:37

问题


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 ?


回答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.




回答2:


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




回答3:


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.



来源:https://stackoverflow.com/questions/35966632/abc-ic-ab-back-material-resource-not-found-in-support-library-23-2-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!