Last active
May 6, 2019 16:17
-
-
Save gunhansancar/a5883b7e218d5bd1ca44 to your computer and use it in GitHub Desktop.
This is a sample build.gradle file for your android libraries to change their artifact file names. You can find more information on http://gunhansancar.com/how-to-change-apk-file-name-in-android/
This file contains hidden or 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
//apply plugin: 'com.android.library' //uncomment this line for android libraries | |
//apply plugin: 'com.android.application' //uncomment this line for android applications | |
def renameArtifact(variant, defaultConfig) { | |
variant.outputs.each { output -> | |
def formattedDate = new Date().format('yyyyMMddHHmmss') | |
def fullName = output.outputFile.name | |
def projectName = fullName.substring(0, fullName.indexOf('-')) | |
output.outputFile = new File( | |
(String) output.outputFile.parent, | |
(String) output.outputFile.name.replace(projectName, "${projectName}-${defaultConfig.versionName}-${formattedDate}")) | |
} | |
} | |
android { | |
compileSdkVersion 23 | |
buildToolsVersion '23.0.2' | |
//include this line for your android libraries | |
//libraryVariants.all { variant -> renameArtifact(variant, defaultConfig) } | |
//include this line for your android applications | |
//applicationVariants.all { variant -> renameArtifact(variant, defaultConfig) } | |
defaultConfig { | |
minSdkVersion 10 | |
targetSdkVersion 23 | |
versionCode 1 | |
versionName "1.0" | |
} | |
buildTypes { | |
release { | |
minifyEnabled true | |
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | |
} | |
} | |
} | |
dependencies { | |
compile fileTree(dir: 'libs', include: ['*.jar']) | |
//include your dependencies | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ñ