Appcompat,启动时崩溃 - 无效的可绘制标记向量

时间:2016-12-11 16:12:06

标签: android android-support-library

启动我的应用时出错

    ...
        Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class android.support.v7.widget.Toolbar
    ...
        Caused by: android.content.res.Resources$NotFoundException: File res/drawable/abc_ic_ab_back_material.xml from drawable resource ID #0x7f020013
    ...
        Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #17: invalid drawable tag vector

我的build.gradle

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
    }
}

android {
    compileSdkVersion 25
    buildToolsVersion '25.0.1'

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 25
        multiDexEnabled true
        vectorDrawables.useSupportLibrary true
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.android.support:support-v4:25.0.1'
    compile 'com.android.support:appcompat-v7:25.0.1'
    compile 'com.android.support:design:25.0.1'
    compile 'com.android.support:preference-v14:25.0.1'
    compile 'com.android.support:preference-v7:25.0.1'
    compile 'com.android.support:recyclerview-v7:25.0.1'
    compile 'com.android.support:cardview-v7:25.0.1'
}

我没有使用矢量绘图,因此代码中没有相关的错误。尝试了所有可能的答案。应用程序继续在API< 21

上崩溃

1 个答案:

答案 0 :(得分:0)

解决了这个问题。在我的情况下,麻烦在于我正在应用于ToolBar的应用主题。我使用自定义颜色属性,并且inflater无法识别它,因为它指向无处