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

后端 未结 18 801
野性不改
野性不改 2020-11-27 15:49

After solving a JDK zero value error, now I\'m facing this one. I did a little research, but it seems I can\'t get to the point. Here is the log error:

FATA         


        
相关标签:
18条回答
  • 2020-11-27 16:04

    Ok, i just solved my problem, the problem was my gradle outdated and my sdk , so if anyone is running with this problem just do this steps

    1.- Make sure your libs are updated as piotrek1543 says above 2.- Update your sdk if is necesary 3.- Update your gradle files (VERY IMPORTANT) just go to the project gradle and add this

    classpath 'com.android.tools.build:gradle:2.1.0'
    

    then go to your app project > app > graddle > graddlewrapper.properties and add

    distributionUrl=https://services.gradle.org/distributions/gradle-2.10-all.zip
    

    4.- change your compile compileSdkVersion to 24 and your buildToolsVersion "24.0.2" (MAKE SURE YOUR DEPENDENCES ARE UP TO DATE WITH THE SDK)

    Have fun

    0 讨论(0)
  • 2020-11-27 16:04

    If you are using ?attr inside your drawable, this could be the reason of error.

    consider replacing it with Vector Drawable so it can be used in all android versions:

    Replace

    <?xml version="1.0" encoding="utf-8"?>
    <selector xmlns:android="http://schemas.android.com/apk/res/android">
        <item>
            <shape android:shape="rectangle">
                <solid android:color="?attr/navigationIconColor" />
            </shape>
        </item>
    </selector>
    

    With:

    <vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="37dp"
        android:height="5dp"
        android:viewportWidth="37"
        android:viewportHeight="5">
      <path
          android:pathData="M2.5,0h32C35.9,0 37,1.1 37,2.5l0,0C37,3.9 35.9,5 34.5,5h-32C1.1,5 0,3.9 0,2.5l0,0C0,1.1 1.1,0 2.5,0z"
          android:fillColor="?attr/navigationIconColor"/>
    </vector>
    
    
    0 讨论(0)
  • 2020-11-27 16:05

    use like this in your Activity:

    public class MainActivity extends AppCompatActivity {
        static {
            AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
         }
      ...
    }
    

    and this in your build.gradle :

    android {
        ...
    
         defaultConfig {
             ....
             vectorDrawables.useSupportLibrary = true
        }
    

    }

    and in your xml:

    app:srcCompat="@drawable/your_icon"
    
    0 讨论(0)
  • 2020-11-27 16:05

    Changing the kotlin-stdlib dependency from:

    implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:1.2.0" to

    implementation "org.jetbrains.kotlin:kotlin-stdlib:1.2.0" fixed the error.

    0 讨论(0)
  • 2020-11-27 16:06

    If any of the other solutions does not work, you can add this line in your Activity

    static {
        AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
    }
    

    and of course, update your gradle and appcompat to the latest versions. This worked in my case.

    0 讨论(0)
  • 2020-11-27 16:07

    in my case the XML contained android:endX that supports from 24 and up.

    0 讨论(0)
提交回复
热议问题