Hi Stephan,
I have pasted your code in the android section of my build file, but it complains it does not know applicationVariants...
Here iss my build file :
apply plugin: 'android'
android {
/*
buildVariants.each { variant ->
apk = variant.packageApplication.outputFile;
newName = apk.name.replace(".apk", "-v" + defaultConfig.versionName + "-release.apk");
} else {
newName = apk.name.replace(".apk", "-v" + defaultConfig.versionName + "-beta.apk");
}
variant.packageApplication.outputFile = new File(apk.parentFile, newName);
if (variant.zipAlign) {
variant.zipAlign.outputFile = new File(apk.parentFile, newName.replace("-unaligned", ""));
}
*/
signingConfigs {
release {
storeFile file("../r.keystore")
storePassword "*****"
keyAlias "*****"
keyPassword "******"
}
}
compileSdkVersion 19
buildToolsVersion '19.1.0'
defaultConfig {
applicationId 'biz.****.android'
minSdkVersion 14
targetSdkVersion 19
versionCode 0
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
productFlavors {
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
applicationVariants.all { variant ->
def apk = variant.outputFile;
def newName;
// newName = apk.name.replace(".apk", "-v" + defaultConfig.versionName + "-" + variant.buildType.name.toUpperCase() + ".apk");
newName = apk.name.replace(".apk", "-v" + defaultConfig.versionName + "-release.apk");
} else {
newName = apk.name.replace(".apk", "-v" + defaultConfig.versionName + "-beta.apk");
}
// newName = newName
variant.outputFile = new File(apk.parentFile, newName);
if (variant.zipAlign) {
variant.outputFile = new File(apk.parentFile, newName.replace("-unaligned", ""));
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
/* Utilities & compatibility */
compile 'org.apache.commons:commons-lang3:3.3.1'
compile "com.android.support:support-v4:19.1.+"
/* Car systems Common Library */
compile project(':CommonsDroid')
/* JSon tests */
compile 'com.fasterxml.jackson.core:jackson-databind:2.4.0-rc3'
compile 'com.google.code.gson:gson:1.7.2'
/* ORM */
compile 'com.j256.ormlite:ormlite-android:4.45'
}
Thank you all for your help,
JM