我目前正在使用Gradle Experimental 0.2.1,但我不能使用更新的版本。
我不知道它是否相关,但我需要使用新的Vectore支持。
我尝试将vectorDrawables.useSupportLibrary = true
添加到defaultConfig.with
阻止,但Gradle Sync会失败,说它无法识别此功能。
我得到的错误是:
错误:没有这样的属性:类的vectorDrawables:com.android.build.gradle.managed.ProductFlavor
这是我的Gradle Build File:
apply plugin: 'com.android.model.application'
model {
android {
compileSdkVersion = 23
buildToolsVersion = '22.0.1'
defaultConfig.with {
applicationId = "my.application.com
minSdkVersion.apiLevel = 18
targetSdkVersion.apiLevel = 23
versionCode = 1
versionName = "1.0"
vectorDrawables.useSupportLibrary = true // this will fail
}
}
android.packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/services/javax.annotation.processing.Processor'
exclude 'META-INF/DEPENDENCIES'
}
// NDK
android.ndk {
moduleName = "MyAwesomeJNILib"
cppFlags += "-std=c++11"
stl = 'gnustl_shared'
}
android.buildTypes {
release {
minifyEnabled = false
proguardFiles += file('proguard-rules.pro')
}
debug {
minifyEnabled = false
proguardFiles += file('proguard-rules.txt')
debuggable = true
}
}
android.productFlavors {
create("demo") {
applicationId = "my.application.com.demo"
}
create("dev") {
applicationId = "my.application.com.dev"
}
}
compileOptions.with {
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
}
}
在依赖性块中,我确保使用
compile' com.android.support:appcompat-v7:23.4.0'