Android: Solve the Problem of Gradle DSL method not found: & #39; runProguard () & #39;
After Android Studio is upgraded to the latest version (1.0 RC 4), the following problems occur when running the project:
Gradle DSL method not found: 'runproguard ()'
The reason for this problem is that the runProguard () method cannot be found (the method is called in the build. gradle file corresponding to each Module ).
This is because when Android Studio is upgraded, the build. gradle file under the project is automatically uploaded (not the build. gradle file corresponding to the Module !) The following content is modified:
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 }
This is the case before the upgrade (taking my computer as an example, it 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, which may be effective.
However, this is obviously not the best method. After reading the official documentation (http://tools.android.com/tech-docs/new-build-system) found that in the new version of gradle, runProguard this method has been abandoned, and changed to the new method:minifyEnabled
. Therefore, the correct solution is not to modify the version number of gradle, but to change the runProguard method name in the build. gradle file corresponding to each Module in the projectMinifyEnabled, that is:
buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } }
The problem is solved perfectly.