Skip to content

Commit

Permalink
Add version names in apks
Browse files Browse the repository at this point in the history
  • Loading branch information
f2prateek committed Nov 28, 2013
1 parent 80968ac commit b846e13
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,30 @@ android {
release {
signingConfig signingConfigs.release
}

applicationVariants.all { variant ->
apk = variant.packageApplication.outputFile;

if (variant.buildType.name == "release") {
newName = apk.name.replace(".apk", "-v" + defaultConfig.versionName + "-RELEASE.apk");
} else {
newName = apk.name.replace(".apk", "-v" + defaultConfig.versionName + "-SNAPSHOT.apk");
}

newName = newName.replace("-" + variant.buildType.name, "");

variant.packageApplication.outputFile = new File(apk.parentFile, newName);
if (variant.zipAlign) {
variant.zipAlign.outputFile = new File(apk.parentFile, newName.replace("-unaligned", ""));
}
}
}

defaultConfig {
minSdkVersion 14
targetSdkVersion 19
versionCode 116
versionName '1.1.6'
buildConfig """\
public static final boolean RELEASE = !DEBUG;
"""
Expand Down

0 comments on commit b846e13

Please sign in to comment.