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,
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 GraphicsCopy 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
Gradle Error:Execution Failed for Task ':App:Processdebuggoogleservices'
The Android Emulator Is Out of View, How to Move It
Programmatic Screencapture on Mobile Device
Open Android App from Url Using Intent-Filter Not Working
Why Shouldn't I Use System.Out.Println() in Android
Eclipse Installation Error: Install_Failed_Uid_Changed
Mpandroid Chart Not Displaying Any Labels for Xaxis , What Is Missing
Kotlin and Firebase Read and Write Data
How to Use the Proguard in Android Studio
Android Listview Setselection() Does Not Seem to Work
Broadcast Receiver to Detect Application Start
How to Get File Path from Sd Card in Android
Limit Scrolling and Zooming Google Maps Android API V2