buildTypes android 工作室错误
buildTypes android studio error
我在我的项目 gradle 文件中遇到此错误:
'buildTypes' cannot be applied to '(groovy.lang.Closure<
com.android.build.gradle.internal.dsl.BuildType>)'
我目前使用的是AndroidStudio 1.1.0、compileSdkVersion 22、buildToolsVersion 22.0.0 和targetSdkVersion 22。使用compileSdkVersion 21 似乎可以解决这个问题。有什么建议吗?
编辑:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.0"
defaultConfig {
applicationId "com.xxxx.yyyy"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services-location:7.0.0'
}
我开始了一个新项目,我发现它运行良好,所以我只复制了 build.gradle 文件。实际上唯一的区别是缺少 compileOptions 部分。我删除了该部分,同步 gradle,再次插入该部分,再次同步 gradle,现在可以使用了!
我在我的项目 gradle 文件中遇到此错误:
'buildTypes' cannot be applied to '(groovy.lang.Closure< com.android.build.gradle.internal.dsl.BuildType>)'
我目前使用的是AndroidStudio 1.1.0、compileSdkVersion 22、buildToolsVersion 22.0.0 和targetSdkVersion 22。使用compileSdkVersion 21 似乎可以解决这个问题。有什么建议吗?
编辑:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.0"
defaultConfig {
applicationId "com.xxxx.yyyy"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services-location:7.0.0'
}
我开始了一个新项目,我发现它运行良好,所以我只复制了 build.gradle 文件。实际上唯一的区别是缺少 compileOptions 部分。我删除了该部分,同步 gradle,再次插入该部分,再次同步 gradle,现在可以使用了!