buildTypes不能应用于groovy.lang.Closure [英] buildTypes cannot be applied to groovy.lang.Closure
问题描述
我在我的gradle项目文件中获取这样的警告:
I'm getting this warning in my project gradle file:
警告:(16,5)'buildTypes'不能被应用到'(groovy.lang.Closure&下; com.android.build.gradle.internal.dsl.BuildType>)'
Warning:(16, 5) 'buildTypes' cannot be applied to '(groovy.lang.Closure< com.android.build.gradle.internal.dsl.BuildType>)'
我buildTypes部分是:
My buildTypes section is:
buildTypes {
debug {
debuggable true
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
}
我目前使用的Android 1.1.0工作室,compileSdkVersion 22,buildToolsVersion 22.0.0和targetSdkVersion 22.我想退缩至21日,但仍然得到了警告。
I'm currently using Android Studio 1.1.0, compileSdkVersion 22, buildToolsVersion 22.0.0, and targetSdkVersion 22. I tried backing down to 21 but was still getting the warning.
是什么原因导致这样的警告和放大器;它是如何固定?
What causes this warning & how is it fixed?
推荐答案
对于我来说,问题不是通过应用上述解决方案解决的。相反,我不得不去到Android Studio中的设置,并选择使用gradle这个包装:
For me the problem was not solved by applying the above solution. Instead I had to go to the settings within Android Studio and select "Use gradle wrapper":
在Android Studio中进行选择:
文件\\设置\\构建,执行,部署\\构建TOOLS \\摇篮
In Android Studio select: File\Settings\Build, Execution, Deployment\Build tools\Gradle
(Mac用户: Android的工作室\\ preferences ... \\建立,执行,部署\\构建TOOLS \\摇篮)
标记:使用的gradle默认封装(默认)
这取消了所有不能应用于(groovy.lang.Closure')警告,在构建文件。
This removed all 'cannot be applied to '(groovy.lang.Closure') warnings in the build files.
这篇关于buildTypes不能应用于groovy.lang.Closure的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!