0

I want to make aab file name by build type. But it is not made.

compileSdkVersion 30
buildToolsVersion "30.0.2"
targetSdkVersion 30

buildTypes {
        def project = "myapplication"
        def separator = "_"
        def date = new Date();
        def formattedDate = date.format('yyyyMMdd_HHmm')
       release {
           setProperty("archivesBaseName", "${project}${separator}release${separator}${formattedDate}")
        }
        
debug {
           setProperty("archivesBaseName", "${project}${separator}debug${separator}${formattedDate}")
        }

or

def buildType
    applicationVariants.all { variant ->
       variant.outputs.each { output ->
            buildType = variant.buildType.name
    }
    }
 setProperty("archivesBaseName", "${project}${separator}${buildType} ${separator}${formattedDate}")

build type = null

What is the problem?

dawonbe
  • 11
  • 1

2 Answers2

1

I think you are asking how to output your app in .aab instead of .apk? Also, the name of the unsigned .apk dropped by your build tools, (IME with various IDEs) is ALWAYS debug unless you change that in the settings/preferences.

Are you using Anroid Studio/Visual Studio/another IDE to build your app? If so you can reconfigure your build tools to output in an App Bundle. Check the manuals/settings/preferences to see where they output your app build to.

If you are using a custom toolchain to build with, then you need to head over to github and grab 'bundletool'. Here are some useful links to point you in the right direction:

Answer:Difference between apk (.apk) and app bundle (.aab)

bundletool on Github

All The Info On App Bundles Straight From Android Themselves

Answer:How to deploy an aab file on device?

Dharman
  • 30,962
  • 25
  • 85
  • 135
0

Try to put setProperty("archivesBaseName", BuildVariables.applicationId) out of release {} section

Pietrek
  • 1,420
  • 14
  • 18