Android   发布时间:2022-04-28  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了android – 工具栏:IllegalStateException – 为VectorDrawableCompat配置你的构建大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在使用 Android studio 2.1.2.我用minSdkVersion开始了一个新项目为19.我的活动扩展了AppCompatActivity.该项目以使用片段的空活动开始.

使用API​​ 24预览content_main.xml时,一切都很好.在预览API 19时,我遇到以下渲染问题:

The following classes Could not be instantiated:
- android.support.v7.widget.Toolbar
java.lang.IllegalStateException: This app has been built with an incorrect configuration. Please configure your build for VectorDrawableCompat

添加了我发现的与gradle相关的所有内容(2个文件):

classpath 'com.android.tools.build:gradle:2.1.2'
**vectorDrawableS.UseSupportLibrary = true**
buildToolsVersion "24.0.1"
compile 'com.android.support:appcompat-v7:24.1.1'
**compile "com.android.support:support-v4:24.1.1"**
compile 'com.android.support:design:24.1.1

但仍然出现错误.我在互联网上找到了很多答案.但没有人帮助.使用API​​ 19的新工具栏是否有问题?

解决方法

这对我很有用
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"

defaultConfig {
    applicationId "com.example.app"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
    generatedDensities = []
}

// This is handled for you by the 2.0+ Gradle Plugin
aaPTOPtions {
    additionalParameters "--no-version-vectors"
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
    }
}

}

请注意以上代码

// This is handled for you by the 2.0+ Gradle Plugin
aaPTOPtions {
    additionalParameters "--no-version-vectors"
}

generatedDensities = []

大佬总结

以上是大佬教程为你收集整理的android – 工具栏:IllegalStateException – 为VectorDrawableCompat配置你的构建全部内容,希望文章能够帮你解决android – 工具栏:IllegalStateException – 为VectorDrawableCompat配置你的构建所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。