Deploy to Bitrise step failed with error: Program type already present

Hi guys,

I am getting following error when trying bundle the universal APKs from . aab (v1.9.2) during the deploy-to-bitrise-io step.

The log was printed as below:

java "-jar" "/var/folders/6q/wgy6jtp12w5gzgm9lzcglpqw0000gn/T/tool838238510/bundletool-all-0.9.0.jar" "build-apks" "--mode=universal" "--bundle" "/Users/vagrant/deploy/app-debug.aab" "--output" "/var/folders/6q/wgy6jtp12w5gzgm9lzcglpqw0000gn/T/aab-bundle807550645/universal.apks" "--ks" "/var/folders/6q/wgy6jtp12w5gzgm9lzcglpqw0000gn/T/aab-bundle807550645/debug.keystore" "--ks-pass" "pass:android" "--ks-key-alias" "androiddebugkey" "--key-pass" "pass:android" failed (status: 1): Error: Program type already present: $r8$java8methods$utility$Integer$hashCode$II
[BT:0.9.0] 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:333)
	at com.android.tools.build.bundletool.mergers.ModuleSplitsToShardMerger.lambda$mergeDexFilesAndCache$3(ModuleSplitsToShardMerger.java:300)
	at java.util.HashMap.computeIfAbsent(HashMap.java:1127)
	at com.android.tools.build.bundletool.mergers.ModuleSplitsToShardMerger.mergeDexFilesAndCache(ModuleSplitsToShardMerger.java:298)
	at com.android.tools.build.bundletool.mergers.ModuleSplitsToShardMerger.mergeSingleShard(ModuleSplitsToShardMerger.java:192)
	at com.android.tools.build.bundletool.mergers.ModuleSplitsToShardMerger.merge(ModuleSplitsToShardMerger.java:106)
	at com.android.tools.build.bundletool.splitters.BundleSharder.shardBundle(BundleSharder.java:102)
	at com.android.tools.build.bundletool.splitters.ShardedApksGenerator.generateSplits(ShardedApksGenerator.java:68)
	at com.android.tools.build.bundletool.commands.BuildApksManager.execute(BuildApksManager.java:200)
	at com.android.tools.build.bundletool.commands.BuildApksCommand.execute(BuildApksCommand.java:486)
	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)
	... 12 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)
	... 15 more

As I searched, I find out that the error could be caused by using the old bundle tool version 0.9.0 (fixed in version 0.10.3). For more information please refer to this link.

Are there any ways that I can change the bundle tool version to 0.10.3 or do anythings to prevent this from happening?

Thanks and hope to hear from you guys soon.

The fastest way is to fork the repo, change bundletool version number here: https://github.com/bitrise-steplib/steps-deploy-to-bitrise-io/blob/master/bundletool/bundletool.go#L17 and use your fork (using git step source) instead of version from steplib.

Hi @koral,

Thank you so much for the suggestion. Follow this tutorial after I fork and change the bundletool version, I have to create a pull request in the original StepLib repository. Is there a way that I can use my fork directly without create a pull request?

Thanks,

Look here: https://devcenter.bitrise.io/steps-and-workflows/adding-removing-steps/#adding-steps-from-alternative-sources

Thank @koral. It’s working now.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.