Created
April 16, 2018 20:14
-
-
Save dptsolutions/31e06d0990b7e18cea48b8277f152d7a to your computer and use it in GitHub Desktop.
Name APK output file in following format - {AppName}-{ProductFlavorName}-{BuildTypeName}-{shortGitSha}.apk (Works with Android Gradle Plugin 3.x)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//1. Put this file in the root of your project | |
//2. Add apply from: "../artifacts.gradle" to the end of your app module's build.gradle file | |
android.applicationVariants.all { variant -> | |
def appName | |
def shortGitSha = 'git rev-parse --short HEAD'.execute().text.trim() | |
//Check if an applicationName property is supplied; if not use the name of the parent project. | |
if (project.hasProperty("applicationName")) { | |
appName = applicationName | |
} else { | |
appName = parent.name | |
} | |
variant.outputs.all { | |
outputFileName = "${appName}-${variant.mergedFlavor.versionName}-${variant.productFlavors[0].name}-${variant.buildType.name}-${shortGitSha}.apk" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment