Error:(26, 0) Gradle DSL method not found: 'runProguard()'
Instead of using runProguard
in your gradle file, try using minifyEnabled
. This should fix the issue. runProguard
is deprecated and soon be stop working.
EDIT
To use minifyEnabled
, gradle should be updated to version 2.2 or above.
Change in the app build.gradle file may help:
old:
buildTypes {
release {
runProguard false // this line has to be changed
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
new:
buildTypes {
release {
minifyEnabled false // new version
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
As far as I know runProguard
was replaced with minifyEnabled
. I am still not sure how to define the config for proguard but a Google search should help you to find out.
Edit:
For the outFile
read here: https://groups.google.com/forum/#!topic/adt-dev/4_-5NvxuFB0 how they do it.
In short: they used a more complex version:
applicationVariants.all { variant ->
variant.outputs.each { output ->
def apk = output.outputFile;
def newName;
// newName = apk.name.replace(".apk", "-v" + defaultConfig.versionName + "-" + variant.buildType.name.toUpperCase() + ".apk");
if (variant.buildType.name == "release") {
newName = apk.name.replace(".apk", "-v" + defaultConfig.versionName + "-release.apk");
} else {
newName = apk.name.replace(".apk", "-v" + defaultConfig.versionName + "-beta.apk");
}
output.outputFile = new File(apk.parentFile, newName);
if (output.zipAlign) {
output.outputFile = new File(apk.parentFile, newName.replace("-unaligned", ""));
}
logger.info('INFO: Set outputFile to ' + output.outputFile + " for [" + output.name + "]");
}
}