0

As Android App Bundle is now required for the store we need to update our CD pipeline process.

Are there any tasks to help me do this?

I have been unable to find them or if need be how do I write custom tasks?

Any other things to look out for now we will be working with aab files instead of apk?

We have a Xamarin project writing in visual studio.

As for the Build process, I was able to find that I could use msBuild tasks to create an AAB file using the following, I have been unable to verify if this is a functioning AAB as I can't extract it until our release pipeline is also completed.

- task: XamarinAndroid@1
    displayName: 'Build aab'
    inputs:
      projectFile: $(Build.SourcesDirectory)\<PATH_TO_ANDROID.csproj>
      outputDirectory: '$(Build.BinariesDirectory)'
      configuration: '$(BuildConfiguration)'
      clean: true
      msbuildVersionOption: latest
      msbuildArguments: '/p:JavaSdkDirectory="$(JAVA_HOME_11_X64)/" /t:SignAndroidPackage /p:AndroidNdkDirectory="$(androidNdkPath)" /p:AndroidKeyStore="True" /p:AndroidSigningKeyStore="$(keystore.secureFilePath)" /p:AndroidSigningKeyPass="$(keystore.password)" /p:AndroidSigningKeyAlias=$(key.alias) /p:AndroidSigningStorePass=$(keystore.password)'

...
...
  - task: CopyFiles@2
    displayName: 'Copy deliverables AAB to staging'
    inputs:
      SourceFolder: '$(Build.SourcesDirectory)\<PATH_TO_ANDROID>\bin\$(buildConfiguration)'
      #SourceFolder: '$(Build.BinariesDirectory)' 
      Contents: '*.aab'
      #TargetFolder: 'drop'
      TargetFolder: $(Build.ArtifactStagingDirectory)
...

Then once in the CD release pipeline, currently we do the following:

enter image description here

I was thinking if we can't directly unpack an *.AAB file > make changes > repack >sign it > etc

Then maybe we could convert it to apk > do our other steps above > then convert it back to aab > sign it > etc

I have tried using this one https://marketplace.visualstudio.com/items?itemName=DamienAicheh.bundletool-tasks&targetId=27528779-628c-46e8-9cf5-1848170d72d2

It seems like I was able to convert it from aab > apk (I can't verify truly until this whole process if completed) but then I wasn't able to find a way to repack it and sign it.

steps:
- task: DamienAicheh.bundletool-tasks.install-bundletool-task.InstallBundletool@1
  displayName: 'Install Bundletool'
  inputs:
    username: '******'
    personalAccessToken: '**********'

.....

#Your build pipeline references an undefined variable named ‘AndroidkeystoreFilePath.secureFilePath’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
#Your build pipeline references an undefined variable named ‘AndroidKeyStorePassword’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
#Your build pipeline references an undefined variable named ‘AndroidKeyStoreAlias’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
#Your build pipeline references an undefined variable named ‘AndroidKeyStorePassword’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972

steps:
- task: DamienAicheh.bundletool-tasks.aab-convert-to-universal-apk-task.AabConvertToUniversalApk@1
  displayName: 'Android App Bundle converter to universal Apk'
  inputs:
    aabFilePath: '$(System.DefaultWorkingDirectory)/_CI-Build-v2/Android/****-Signed.aab'
    keystoreFilePath: '$(AndroidkeystoreFilePath.secureFilePath)'
    keystorePassword: '$(AndroidKeyStorePassword)'
    keystoreAlias: '$(AndroidKeyStoreAlias)'
    keystoreAliasPassword: '$(AndroidKeyStorePassword)'
    outputFolder: '$(System.DefaultWorkingDirectory)/_CI-Build-v2/Android/AAB_TO_APK'

1 Answers1

0

As far as i know no, there is no way to unpack your .aab files.

This is a file format intended for distribution through Google Play only.

You could however add steps in your pipeline to also build and sign an .apk file which can be locally distributed and installed, so cou can use this for testing and whatever else you want.

For an example of a pipeline that builds and exports both .apk and .aab see this example

Edit: You can unpack your .aab to .apk, see this thread

Saigronas
  • 38
  • 8