bundletool fails to generate APKs from AAB
See original GitHub issueDescription
bundletool fails to generate APKs from AAB
Steps to reproduce
- Download bundletool and appropriate .aab file (my device is arm64, so I downloaded BraveMonoarm64.aab)
$ alias bundletool='java -jar /home/bruno/Downloads/bundletool-all-1.6.0.jar'
$ bundletool build-apks --bundle=/home/bruno/Downloads/BraveMonoarm64.aab --output=/home/bruno/Downloads/BraveMonoarm64.apks
Actual result
Multiple errors of this sort: “error: failed to deserialize resources.pb: duplicate configuration in resource table.” See below.
$ bundletool build-apks --bundle=/home/bruno/Downloads/BraveMonoarm64.aab --output=/home/bruno/Downloads/BraveMonoarm64.apks
WARNING: The APKs won't be signed and thus not installable unless you also pass a keystore via the flag --ks. See the command help for more information.
/tmp/6272904776128236573/proto.apk: error: failed to deserialize resources.pb: duplicate configuration in resource table.
/tmp/6272904776128236573/proto.apk: error: failed to load APK.
/tmp/2071804396523564826/proto.apk: error: failed to deserialize resources.pb: duplicate configuration in resource table.
/tmp/2071804396523564826/proto.apk: error: failed to load APK.
/tmp/6188646547516233480/proto.apk: error: failed to deserialize resources.pb: duplicate configuration in resource table.
/tmp/6188646547516233480/proto.apk: error: failed to load APK.
/tmp/9019322073981279585/proto.apk: error: failed to deserialize resources.pb: duplicate configuration in resource table.
/tmp/9019322073981279585/proto.apk: error: failed to load APK.
/tmp/6442691279476123884/proto.apk: error: failed to deserialize resources.pb: duplicate configuration in resource table.
/tmp/6442691279476123884/proto.apk: error: failed to load APK.
/tmp/598732138771193428/proto.apk: error: failed to deserialize resources.pb: duplicate configuration in resource table.
/tmp/598732138771193428/proto.apk: error: failed to load APK.
---snip---
/tmp/4148553829505242576/proto.apk: error: failed to deserialize resources.pb: duplicate configuration in resource table.
/tmp/4148553829505242576/proto.apk: error: failed to load APK.
/tmp/5976620259936164327/proto.apk: error: failed to deserialize resources.pb: duplicate configuration in resource table.
/tmp/5976620259936164327/proto.apk: error: failed to load APK.
[BT:1.6.0] Error: Command '[/tmp/AutoValue_BuildApksCommand5394129551921328319/output/linux/aapt2, convert, --output-format, binary, -o, /tmp/5976620259936164327/binary.apk, /tmp/5976620259936164327/proto.apk]' didn't terminate successfully (exit code: 1). Check the logs.
com.android.tools.build.bundletool.model.exceptions.CommandExecutionException: Command '[/tmp/AutoValue_BuildApksCommand5394129551921328319/output/linux/aapt2, convert, --output-format, binary, -o, /tmp/5976620259936164327/binary.apk, /tmp/5976620259936164327/proto.apk]' didn't terminate successfully (exit code: 1). Check the logs.
at com.android.tools.build.bundletool.model.exceptions.InternalExceptionBuilder.build(InternalExceptionBuilder.java:57)
at com.android.tools.build.bundletool.androidtools.DefaultCommandExecutor.executeImpl(DefaultCommandExecutor.java:57)
at com.android.tools.build.bundletool.androidtools.DefaultCommandExecutor.execute(DefaultCommandExecutor.java:33)
at com.android.tools.build.bundletool.androidtools.Aapt2Command$1.convertApkProtoToBinary(Aapt2Command.java:53)
at com.android.tools.build.bundletool.io.ApkzlibApkSerializerHelper.writeToZipFile(ApkzlibApkSerializerHelper.java:136)
at com.android.tools.build.bundletool.io.ApkzlibApkSerializerHelper.writeToZipFile(ApkzlibApkSerializerHelper.java:109)
at com.android.tools.build.bundletool.io.SplitApkSerializer.writeToDisk(SplitApkSerializer.java:68)
at com.android.tools.build.bundletool.io.SplitApkSerializer.writeSplitToDisk(SplitApkSerializer.java:42)
at com.android.tools.build.bundletool.io.ApkSetBuilderFactory$ApkSetArchiveBuilder.addSplitApk(ApkSetBuilderFactory.java:106)
at com.android.tools.build.bundletool.io.ApkSerializerManager$ApkSerializer.serialize(ApkSerializerManager.java:461)
at com.android.tools.build.bundletool.io.ApkSerializerManager.lambda$null$3(ApkSerializerManager.java:225)
at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:69)
at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Expected result
No errors, APK gets built.
Issue reproduces how often
100% of the time.
Brave version
Release v1.24.84
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Unable to create an APK from an AAB when system locale is ...
Describe the bug Unable to create a universal APK from an AAB file when ... This is caused by the way bundletool parses...
Read more >java - Unable to generate APKs from aab using bundletool in ...
INFO: The APKs will be signed with the debug keystore found at 'C:\Users\HP.android\debug.keystore'. [BT:1.11.0] Error: Invalid uncompressed ...
Read more >bundletool - Android Developers
bundletool is the underlying tool that Android Studio, the Android Gradle plugin, and Google Play use to build an Android App Bundle.
Read more >Error while publishing AAB to internal sharing console after ...
After this, we always getting error while publishing AAB to the play internal sharing console saying "An error occurred while running bundletool build-apks...
Read more >How to Generate and Extract APK Files from Android App ...
Using bundletool command, you can extract APK files from Android App Bundle (.aab) and test them manually on different device configurations ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thank you, wchen342!!! Now it works like a charm 😃
For other users interested in building/installing .apks from the .aab file:
.aab
file from Brave’s github pagebundletool
and chromium project’saapt2
(for the latter, see wchen342’s link above).apks
file. My command, as an example, was this:$ adb start-server
.apks
to your Android device:Note that if brave-browser from an official app store is already installed on your Android device, the installation step will fail because when upgrading an app your device requires that current app version and new app version be signed with same signature. Therefore, you have to uninstall the official brave-browser before you can install your self-signed version (I use the
oandbackup
app to backup my browser’s data so that I can restore the data after installing the self-signed apk).Happy hacking!
P.S. A wishlist item: It would be nice if a link to the appropriate
aapt2
binary were provided with each brave-browser release’s “Assets”. This way, “mere mortal” users such as myself would be alerted to the fact that theaapt2
included inbuildtool
is not going to work. It would also safeguard against problems from users using an outdatedaapt2
from chromium source tree.