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?
gradle file is located inside your project folder under app/build. gradle.
Gradle Bundle Plugin allows you to create OSGI bundles.
In Eclipse, select File > Export. In the window that appears, open Android and select Generate Gradle build files. Select the project you want to export for Android Studio and click Finish.
You could use something like this:
defaultConfig { applicationId "com.test.app" versionCode 1 versionName "1.0" setProperty("archivesBaseName", applicationId + "-v" + versionCode + "(" + versionName + ")") }
As a more generic way to Martin Zeitlers answer the following will listen for added tasks, then insert rename tasks for any bundle*
task that gets added.
Just add it to the bottom of your build.gradle
file.
Note: It will add more tasks than necessary, but those tasks will be skipped since they don't match any folder. e.g.
> Task :app:renameBundleDevelopmentDebugResourcesAab NO-SOURCE
tasks.whenTaskAdded { task -> if (task.name.startsWith("bundle")) { def renameTaskName = "rename${task.name.capitalize()}Aab" def flavor = task.name.substring("bundle".length()).uncapitalize() tasks.create(renameTaskName, Copy) { def path = "${buildDir}/outputs/bundle/${flavor}/" from(path) include "app.aab" destinationDir file("${buildDir}/outputs/renamedBundle/") rename "app.aab", "${flavor}.aab" } task.finalizedBy(renameTaskName) } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With