Skip to content

Commit b846e13

Browse files
committed
Add version names in apks
1 parent 80968ac commit b846e13

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

app/build.gradle

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,30 @@ android {
6363
release {
6464
signingConfig signingConfigs.release
6565
}
66+
67+
applicationVariants.all { variant ->
68+
apk = variant.packageApplication.outputFile;
69+
70+
if (variant.buildType.name == "release") {
71+
newName = apk.name.replace(".apk", "-v" + defaultConfig.versionName + "-RELEASE.apk");
72+
} else {
73+
newName = apk.name.replace(".apk", "-v" + defaultConfig.versionName + "-SNAPSHOT.apk");
74+
}
75+
76+
newName = newName.replace("-" + variant.buildType.name, "");
77+
78+
variant.packageApplication.outputFile = new File(apk.parentFile, newName);
79+
if (variant.zipAlign) {
80+
variant.zipAlign.outputFile = new File(apk.parentFile, newName.replace("-unaligned", ""));
81+
}
82+
}
6683
}
6784

6885
defaultConfig {
6986
minSdkVersion 14
7087
targetSdkVersion 19
88+
versionCode 116
89+
versionName '1.1.6'
7190
buildConfig """\
7291
public static final boolean RELEASE = !DEBUG;
7392
"""

0 commit comments

Comments
 (0)