After upgrading Android studio to the latest version (1.0 RC 4), there was a problem running the project:
Gradle DSL method not found: ' Runproguard () '
Literally, the reason for this problem is that Runproguard () is not found (this method is called in the corresponding Build.gradle file for each module).
This is because when Android Studio is upgraded, it also automatically build.gradle files under the project (not the module corresponding to the build.gradle! ) changes to the following:
dependencies {
Classpath ' COM.ANDROID.TOOLS.BUILD:GRADLE:1.0.0-RC4 '
Note:do not place your application dependencies here; They belong
In the individual module Build.gradle files
}
And before the upgrade is like this (take my computer as an example, should be similar):
dependencies {
Classpath ' com.android.tools.build:gradle:0.12.2 '
Note:do not place your application dependencies here; They belong
In the individual module Build.gradle files
}
Obviously, the simplest solution is to change the Gradle version back, and this method may indeed work.
However, this is clearly not the best approach. After reviewing the official documentation (Http://tools.android.com/tech-docs/new-build-system ), it was found that in the new version of Gradle, Runproguard This method was obsolete, and changed to a new method: minifyEnabled
. Therefore, the correct workaround is not to modify the version number of the Gradle, but instead to change the Runproguard method name minifyEnabled,即:
in the Build.gradle file for each module in the project to
buildtypes {<br/> release {<br/> minifyenabled false<br/> proguardfiles getdefaultproguardfile (' Proguard-android.txt '), ' Proguard-rules.pro ' <br/>}<br/>}<br/>
Android: Fix Gradle DSL method not found: ' Runproguard () ' Problem