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, modify the contents with environment specific configuration, and then re-pack the apk.
Now that we are trying to do this with an Android App Bundle (AAB), we can no longer use apktool. How can we achieve the same thing with AAB that we could with APK?
This is a snippet of our working apk version of the script
## NOTE STUFF IS TRUNCATED!!! THIS IS NOT A COMPLETE SCRIPT!!! DO NOT COPY
brew list apktool &>/dev/null || HOMEBREW_NO_AUTO_UPDATE=1 brew install apktool
brew list xmlstarlet &>/dev/null || HOMEBREW_NO_AUTO_UPDATE=1 brew install xmlstarlet
# ... truncated ...
echo "Decompiling $zipPath"
apktool d $zipPath -o "apk"
cd apk
# ... truncated / modify androidmanifest.xml ...
unalignedPath="$apkPath.unaligned"
unsignedPath="$apkPath.unsigned"
cd ..
echo "Repackage apk to $unsignedPath"
apktool b apk -o $unsignedPath
echo "Sign"
jarsigner -keystore $keystorePath -storepass $keystorePass -keypass $keystorePass -verbose -sigalg MD5withRSA -digestalg SHA1 -signedjar $unalignedPath $unsignedPath $keyAlias
jarsigner -verify -verbose -certs $unalignedPath
echo "Zipalign"
$ANDROID_HOME/build-tools/27.0.3/zipalign -f -v 4 $unalignedPath $apkPath
When we simply change the file extension from apk
to aab
and run the same apktool, our folder structure is kind of messed up.
Also, the resources and manifest are already converted to protobuf, and I don't think I can reverse engineer them.