Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio and Gradle: versionNameSuffix

I'd like to append special suffixes to my output APK files based on the current buildType. I am trying to use the standard Gradle's versionNameSuffix command:

android {
    defaultConfig {
       ...
       versionNameSuffix "-XXX"
    }
    buildTypes {
        debug {
            versionNameSuffix "-YYY"
        }
        release {
            versionNameSuffix "-ZZZ"
        }
    }
}

For some reason none of these suffixes gets applied to the actual output file name. Does Android Studio ignore this command? Whatever I do the result is the same: <module_name>-debug.apk or <module_name>-release.apk.

Here's my config:

classpath 'com.android.tools.build:gradle:2.2.3'
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
like image 342
fraggjkee Avatar asked Dec 15 '22 01:12

fraggjkee


1 Answers

Does Android Studio ignore this command?

No, but versionNameSuffix does not affect the filename. It affects the versionName (BuildConfig.VERSION_NAME, the version name shown in Settings, etc.).

You can teach Gradle to embed versionName in the APK filename, though.

like image 177
CommonsWare Avatar answered Dec 31 '22 14:12

CommonsWare