How to change the generated filename for App Bundles with Gradle?

Archie G. Quiñones picture Archie G. Quiñones · Sep 26, 2018 · Viewed 13k times · Source

So to change the generated APK filename inside gradle android I could do something like:

applicationVariants.output.all {
    outputFileName = "the_file_name_that_i_want.apk"
}

Is there a similar thing for the generated App Bundle file? How can I change the generated App Bundle filename?

Answer

SaXXuM picture SaXXuM · Sep 26, 2018

You could use something like this:

defaultConfig {
  applicationId "com.test.app"
  versionCode 1
  versionName "1.0"
  setProperty("archivesBaseName", applicationId + "-v" + versionCode + "(" + versionName + ")")
}