Fail to generate universal apks from aab on gradle 5
See original GitHub issueDescribe the bug I tried to build generate universal apks from aab file after upgrading gradle version 5.4.1, I can still generate apks mode universal when I use gradle version 4.10.3
Bundletool version(s) affected Version: 0.10.2
Stacktrace
Error: Program type already present: $r8$java8methods$utility$Integer$hashCode$II
[BT:0.10.2] Error: Dex merging failed.
com.android.tools.build.bundletool.model.exceptions.CommandExecutionException: Dex merging failed.
at com.android.tools.build.bundletool.mergers.D8DexMerger.translateD8Exception(D8DexMerger.java:98)
at com.android.tools.build.bundletool.mergers.D8DexMerger.merge(D8DexMerger.java:77)
at com.android.tools.build.bundletool.mergers.ModuleSplitsToShardMerger.mergeDexFiles(ModuleSplitsToShardMerger.java:334)
at com.android.tools.build.bundletool.mergers.ModuleSplitsToShardMerger.lambda$mergeDexFilesAndCache$2(ModuleSplitsToShardMerger.java:302)
at java.util.HashMap.computeIfAbsent(HashMap.java:1127)
at com.android.tools.build.bundletool.mergers.ModuleSplitsToShardMerger.mergeDexFilesAndCache(ModuleSplitsToShardMerger.java:300)
at com.android.tools.build.bundletool.mergers.ModuleSplitsToShardMerger.mergeSingleShard(ModuleSplitsToShardMerger.java:194)
at com.android.tools.build.bundletool.mergers.ModuleSplitsToShardMerger.merge(ModuleSplitsToShardMerger.java:104)
at com.android.tools.build.bundletool.splitters.BundleSharder.shardBundle(BundleSharder.java:103)
at com.android.tools.build.bundletool.splitters.ShardedApksGenerator.generateSplits(ShardedApksGenerator.java:70)
at com.android.tools.build.bundletool.commands.BuildApksManager.executeWithZip(BuildApksManager.java:179)
at com.android.tools.build.bundletool.commands.BuildApksManager.execute(BuildApksManager.java:110)
at com.android.tools.build.bundletool.commands.BuildApksCommand.execute(BuildApksCommand.java:524)
at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:74)
at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:46)
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete
at com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:76)
at com.android.tools.r8.utils.ExceptionUtils.withD8CompilationHandler(ExceptionUtils.java:45)
at com.android.tools.r8.D8.run(D8.java:67)
at com.android.tools.build.bundletool.mergers.D8DexMerger.merge(D8DexMerger.java:70)
... 13 more
Caused by: com.android.tools.r8.utils.AbortException
at com.android.tools.r8.utils.Reporter.failIfPendingErrors(Reporter.java:77)
at com.android.tools.r8.utils.Reporter.fatalError(Reporter.java:58)
at com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:67)
... 16 more
To Reproduce
./bundletool build-apks --bundle=app/build/outputs/bundle/debug/app.aab --output=app/build/outputs/bundle/debug/app.apks --mode=universal
Expected behavior Universal APKS generated from aab file
Environment: OS: macOS 10.14.5
Additional context I found the same error android studio blog and goole issue tracker but different stacktrace
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Build multiple APKs | Android Developers
When building multiple APKs based on screen density, Gradle always generates a universal APK that contains code and resources for all screen ...
Read more >Generate Universal APK from Android App Bundle
Solved, needs to create universal_apk directory and unzip the .apks bundle and you will get your universal apk, follows this command: $ unzip ......
Read more >Create Upload key and app's release bundle (.aab) file |
To release our App to Google Play store, we need to generate an executable binary file of our compiled app code in the...
Read more >How to Change the Default Generated apk Name in Android ...
In this article, we will see 5 different methods of how we can change the apk name for our release apk. Method 1:...
Read more >Android App Bundles, how to generate APK from AAB
To tackle this issue, we instruct android compiler to create an AAB (app bundle) file instead of an APK. ./gradlew app:bundleDebug. Unlike the ......
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 FreeTop 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
Top GitHub Comments
We’ve updated the version of R8 in 0.10.3. Could you give it a try?
maybe you can try the executableJar from my PR bundletool-all.jar.zip
Currently, updating the r8 in bundletool is the only workaround I found