File res/drawable/abc_ic_ab_back_material.xml from drawable resource ID #0x7f020016 [duplicate]

陌路散爱 提交于 2019-11-26 18:53:24
pRaNaY

I think you need to make changes in your gradle.

// Gradle Plugin 2.0+  
 android {  
   defaultConfig {  
     vectorDrawables.useSupportLibrary = true  
    }  
 }  

You’ll note this new attribute only exists in the version 2.0 of the Gradle Plugin. If you are using Gradle 1.5 you’ll instead use

// Gradle Plugin 1.5  
 android {  
   defaultConfig {  
     // Stops the Gradle plugin's automatic rasterization of vectors
     generatedDensities = []  
  }  
  // Flag to tell aapt to keep the attribute ids around
  // This is handled for you by the 2.0+ Gradle Plugin  
  aaptOptions {  
    additionalParameters "--no-version-vectors"  
  }  
 }  

I found similar question here.

See Support Vector Drawables and Animated Vector Drawables in Android Support Library update. I hope its help you.

As per as the documentation of Google's support library for 24.0.0, they have changed the vector drawable library to what it was before: Added AppCompatDelegate.setCompatVectorFromResourcesEnabled() method to re-enable usage of vector drawables in DrawableContainer objects on devices running Android 4.4 (API level 19) and lower. See AppCompat v23.2 — Age of the vectors! for more information.

I faced the same issue and my SVG statelist drawables used in my project were working just fine till Marshmallow devices.

Later when I got the crash for the same in Android N, I realized that the svgs were a bit corrupted and contained characters like: � and this caused the crash.

But these were not reflected in Android Marshmallow and prior devices.

Make sure your vector drawable doesn't contain any of those characters as the way of parsing has been changed from the library 24.0.0. So vector drawables working fine till Marshmallow might not work in Nougat devices.

Hope this helps :)

Sylvester Yao

I solve this problem by updating my support library from

'com.android.support:appcompat-v7:23.2.0'
'com.android.support:design:23.2.0'

to the same dependencies of 23.2.1.

When I met the problem, I had not made any changes in my module built by Android Studio.

So I was so confused then I tried to update android support library. After updating, please remember update your build.gradle

I solved the issue as follows: Try with changing styles.xml to

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>

This is because if style requires ActionBar there are chances of not finding abc_back button but with no action bar problem is solved

user13097

This worked for me: Replace the com.android.support:design version in build.gradle with one that works. Find which version works by creating a new project from scratch in Android Studio and using the version from that.

I had this problem when I added a Navigation Drawer Activity from the File->New->Activity menu to an older project with Android Studio.

Android Studio added a dependency like so: compile 'com.android.support:design:24.0.0-alpha1' (I'm not sure of the exact version but it had '24' and 'alpha').

I then created a new dummy project, specifying a Navigation Drawer Activity in the new project wizard. I noticed that the new project had a different dependency: compile 'com.android.support:design:23.2.1'

So I took this dependency and put it in the first project, and the problem was solved.

Source - http://android-developers.blogspot.in/2016/02/android-support-library-232.html

when using AppCompat with ImageView (or subclasses such as ImageButton and FloatingActionButton), you’ll be able to use the new app:srcCompat attribute to reference vector drawables (as well as any other drawable available to android:src):

<ImageView  
  android:layout_width="wrap_content"  
  android:layout_height="wrap_content"  
  app:srcCompat="@drawable/ic_add" />  

where you can define your app in your root element as

xmlns:app="http://schemas.android.com/apk/res-auto"

I've had this issue because my Manifest file had style that was defined only in v21 style. Not sure why it was pointing at this type of error but someone may find this helpful.

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