Resources$Notfoundexception: File Res/Drawable/Abc_Ic_Ab_Back_Material.Xml

Resources$NotFoundException: File res/drawable/abc_ic_ab_back_material.xml

IF you're using Gradle Plugin 2.0, you need to make changes in your gradle:

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

If you are using Gradle 1.5 you’ll use instead of previus:

// 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"
}
}

Check also: Update Android Support Library to 23.2.0 cause error: XmlPullParserException Binary XML file line #17<vector> tag requires viewportWidth > 0.

Android Support Library Ref.: Support Vector Drawables and Animated Vector Drawables.

Also update Android Support dependencies from

compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'

to

compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.android.support:design:24.2.0'
compile 'com.android.support:recyclerview-v7:24.2.0'
compile 'com.android.support:cardview-v7:24.2.0'

as you're already using build-tools in version of 24.0.2.

Android: getting Resources$NotFoundException for abc_ic_ab_back_material

The answer to this turned out to be buried at the bottom of this guide:

https://medium.com/@chrisbanes/appcompat-v23-2-age-of-the-vectors-91cbafa87c88#.xucjbsts0

It turns out that all you need to add this line in at the beginning of the activity that will use the resource:

static {
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
}

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

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.

res/drawable/abc_ic_ab_back_material.xml Resources$NotFoundException on Kitkat

There is two solution,

  1. Make your application to use vector drawable, and use vector for back abc_ic_ab_back_material.xml. Lern more at Add Multi-Density Vector Graphics

  2. Copy png, ic_menu_back.png from sdk for back icon and paste it into your project.

android.content.res.Resources$NotFoundException: File res/drawable-v21/launch_background.xml

In file android/app/src/main/AndroidManifest.xml, the exception is resolved by commenting out this:

<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background" />

Removing the above resolves the exception, although I'm not sure if it has any side effect.

Robolectric Resources$NotFoundException:drawable\abc_ic_ab_back_material.xml from drawable resource ID

Explanation

Material means that your sdk should be higher or at least 21, not 18.
That's the reason of this error.

Solution

Change @Config(sdk = 18) to @Config(sdk = 21) or with higher version.

It works.



Related Topics



Leave a reply



Submit