Android工作室有空的可绘制资源

时间:2016-07-15 21:53:37

标签: android android-studio gradle android-gradle

以下是我的Android工作室的详细信息: 版本:2.1.2 Gradle Build:版本:2.1.2(从build.gradle(Project:...)中找到,如果那是我应该看的地方)

我正在尝试构建一个需要在带有API 14(Android ICS)的平板电脑上运行的应用程序。

当我创建一个新的空白活动应用程序时,它最初抱怨渲染主题,我通过选择不同的主题(通常是DeviceDefault工作)来解决这个问题。 但是,如果我尝试在我创建的模拟器中运行模拟我的硬件(屏幕大小和分辨率)甚至使用x86模拟器(运行API 16),我会遇到错误:

07-15 16:17:59.196 1925-1925/net.company.dcb E/AndroidRuntime: FATAL EXCEPTION: main
    java.lang.RuntimeException: Unable to start activity ComponentInfo{net.company.dcb/net.company.dcb.MainActivity}: android.content.res.Resources$NotFoundException: File res/drawable/abc_ic_ab_back_material.xml from drawable resource ID #0x7f020013
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
        at android.app.ActivityThread.access$600(ActivityThread.java:130)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:137)
        at android.app.ActivityThread.main(ActivityThread.java:4745)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:511)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
        at dalvik.system.NativeStart.main(Native Method)
    Caused by: android.content.res.Resources$NotFoundException: File res/drawable/abc_ic_ab_back_material.xml from drawable resource ID #0x7f020013
        at android.content.res.Resources.loadDrawable(Resources.java:1918)
        at android.content.res.Resources.getDrawable(Resources.java:659)
        at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:354)
        at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:193)
        at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:181)
        at android.support.v7.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:689)
        at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:186)
        at android.support.v7.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:77)
        at android.support.v7.app.AppCompatDelegateImplBase.<init>(AppCompatDelegateImplBase.java:83)
        at android.support.v7.app.AppCompatDelegateImplV7.<init>(AppCompatDelegateImplV7.java:146)
        at android.support.v7.app.AppCompatDelegateImplV11.<init>(AppCompatDelegateImplV11.java:28)
        at android.support.v7.app.AppCompatDelegateImplV14.<init>(AppCompatDelegateImplV14.java:41)
        at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:193)
        at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:173)
        at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:511)
        at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:71)
        at net.company.dcb.MainActivity.onCreate(MainActivity.java:10)
        at android.app.Activity.performCreate(Activity.java:5008)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 
        at android.app.ActivityThread.access$600(ActivityThread.java:130) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 
        at android.os.Handler.dispatchMessage(Handler.java:99) 
        at android.os.Looper.loop(Looper.java:137) 
        at android.app.ActivityThread.main(ActivityThread.java:4745) 
        at java.lang.reflect.Method.invokeNative(Native Method) 
        at java.lang.reflect.Method.invoke(Method.java:511) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
        at dalvik.system.NativeStart.main(Native Method) 
    Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #17: invalid drawable tag vector
        at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:877)
        at android.graphics.drawable.Drawable.createFromXml(Drawable.java:818)
        at android.content.res.Resources.loadDrawable(Resources.java:1915)
        at android.content.res.Resources.getDrawable(Resources.java:659) 
        at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:354) 
        at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:193) 
        at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:181) 
        at android.support.v7.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:689) 
        at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:186) 
        at android.support.v7.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:77) 
        at android.support.v7.app.AppCompatDelegateImplBase.<init>(AppCompatDelegateImplBase.java:83) 
        at android.support.v7.app.AppCompatDelegateImplV7.<init>(AppCompatDelegateImplV7.java:146) 
        at android.support.v7.app.AppCompatDelegateImplV11.<init>(AppCompatDelegateImplV11.java:28) 
        at android.support.v7.app.AppCompatDelegateImplV14.<init>(AppCompatDelegateImplV14.java:41) 
        at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:193) 
        at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:173) 
        at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:511)            at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:71) 
        at net.company.dcb.MainActivity.onCreate(MainActivity.java:10) 
        at android.app.Activity.performCreate(Activity.java:5008) 
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 
        at android.app.ActivityThread.access$600(ActivityThread.java:130) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 
        at android.os.Handler.dispatchMessage(Handler.java:99) 
        at android.os.Looper.loop(Looper.java:137) 
        at android.app.ActivityThread.main(ActivityThread.java:4745) 
        at java.lang.reflect.Method.invokeNative(Native Method) 
        at java.lang.reflect.Method.invoke(Method.java:511) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
        at dalvik.system.NativeStart.main(Native Method) 
07-15 16:17:59.236 1925-1930/net.company.dcb D/dalvikvm: GC_CONCURRENT freed 310K, 7% free 6063K/6471K, paused 25ms+0ms, total 33ms

这是我的build.gradle(模块:app)

apply plugin: 'com.android.application'
android {
    compileSdkVersion 24
    buildToolsVersion "22.0.1"
    defaultConfig { 
        applicationId "net.company.dkb"
        minSdkVersion 14
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.0.0'
}

0 个答案:

没有答案