Dear Community ,
it is my first message to the community.
I need a help to rename the release apk file from default name to my customer name
example : “myapplication_r”+Subversion Revision+".apk"
So my problem is to get the Subversion Revision from SVN. So I have creade a method
def svnversionSVN() {
description 'Get SVN revision number.'
new ByteArrayOutputStream().withStream { os ->
def result = exec {
executable = 'svnversion'
standardOutput = os
}
ext.revid = os.toString()
}
return svnversion.revid
}
Then I add the result of this method to my apk name :
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
applicationVariants.all { variant ->
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.apk')) {
def fileName = outputFile.name.replace('.apk', "myapplication_r"+svnversionSVN()+".apk")
output.outputFile = new File(outputFile.parent, fileName)
}
}
}
}
debug {
}
}
but it doesn’t work
I have a problem “Error:(58, 0) Could not find property ‘svnversion’ on project ‘:app’.” when I sync Gradle
Any help please ?
I’m beginner with Gradle and ANdroid Studio