Modify Android App Bundle (aab) Contents before deploying

前端 未结 1 1815
感动是毒
感动是毒 2021-01-06 08:30

We have a build and release pipeline (Azure Devops) that deploys our APK Android app to various appcenter.ms environments. During the release process we unpack the apk, mod

相关标签:
1条回答
  • 2021-01-06 09:09

    To edit the manifest of the AAB, you'll need to extract the file base/manifest/AndroidManifest.xml from the AAB, e.g.

    unzip -p app.aab base/manifest/AndroidManifest.xml > AndroidManifest.pb
    

    At this stage, in spite of its extension, the manifest is in a protocol buffer format (this is why I gave it the extension .pb above). You'll thus then need to find a protocol buffer parser/editor to make the changes you need.

    To parse the proto, you'll need the definition of the protocol buffer, which you can find in this JAR: https://maven.google.com/com/android/tools/build/aapt2-proto/3.6.3-6040484/aapt2-proto-3.6.3-6040484.jar See message XmlNode in Resources.proto

    Once you've made the changes on the parsed proto, re-serialize the proto and re-inject it at the same place with the same name in the AAB (it's just a zip file).

    Finally, you don't need to zip-align the AAB, so remove this step.

    Maybe in the future a tool will allow do you the conversion for you automatically, similarly to what apktool does. In the meantime, you can do it manually this way. Hope that helps.

    0 讨论(0)
提交回复
热议问题