将Android Studio从Beta升级到1.0.1版本后,提示推荐升级Gradle Build Tools版本到1.0.0,引发了以下错误
Error18, 0) Gradle DSL method not found: 'runProguard()'
Possible causes:<ul><li>The project 'Scanner' may be using a version of Gradle that does not contain the method.
<a href="open.wrapper.file">Open Gradle wrapper file</a></li><li>The build file may be missing a Gradle plugin.
<a href="apply.gradle.plugin">Apply Gradle plugin</a></li>
Before upgrade build tools version:
dependencies {
classpath 'com.android.tools.build:gradle:0.12.0'
}
After upgrade build tools version:
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
初步定位为Build System的问题,立即查看Android官方文档,See Android Build System,发现从0.14.0之后runProguard变更为minifyEnabled。
Previous code :
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
Current code :
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
--转自