我正在使用 Android Studio 1.5.1、Gradle 2.8 和我的项目最小 sdk 版本:14,目标 sdk 版本:23。
所以,当我通过 Google 文档将 vectorDrawables 添加到配置时:添加了 VectorDrawable 支持库,我收到以下错误:
Error:(13, 0) Could not find property 'vectorDrawables' on ProductFlavor_Decorated{name=main, dimension=null, minSdkVersion=ApiVersionImpl{mApiLevel=14, mCodename='null'}, targetSdkVersion=ApiVersionImpl{mApiLevel=23, mCodename='null'}, renderscriptTargetApi=null, renderscriptSupportModeEnabled=null, renderscriptNdkModeEnabled=null, versionCode=25, versionName=1.0.25, applicationId=com.smsoft.alibaba, testApplicationId=null, testInstrumentationRunner=null, testInstrumentationRunnerArguments={}, testHandleProfiling=null, testFunctionalTest=null, signingConfig=null, resConfig=null, mBuildConfigFields={}, mResValues={}, mProguardFiles=[], mConsumerProguardFiles=[], mManifestPlaceholders={}}.
这是我的构建.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.smsoft.alibaba"
minSdkVersion 14
targetSdkVersion 23
versionCode 25
versionName "1.0.25"
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:23.2.0'
compile 'com.android.support:design:23.2.0'
compile 'com.android.support:support-v4:23.2.0'
compile 'com.android.support:cardview-v7:23.2.0'
}
有人知道如何解决这个问题吗?
EDIT
感谢 @Gabriele Mariotti 指出我对 gradle 和 gradle 插件之间的困惑。在阅读添加 Compact Vector Drawables 说明时,我很困惑。