I\'m using Gradle to compile my Android project:
buildTypes {
release {
signingConfig signingConfigs.release
applicationVariants.all { varia
I solved using this code:
buildTypes {
release {
signingConfig signingConfigs.release
}
applicationVariants.all { variant ->
def apk = variant.packageApplication.outputFile;
def newName = apk.name.replace(".apk", "-renamed.apk");
variant.packageApplication.outputFile = new File(apk.parentFile, newName);
if (variant.zipAlign) {
variant.zipAlign.outputFile = new File(apk.parentFile, newName.replace("-unaligned", ""));
}
}
}
The block applicationVariants.all {...}
is now outside the release {...}
block.
I think variant.zipAlign.outputFile
makes the difference.