Flutter Android build fails due to multidex error, compiles locally

Bitrise Build Issue Report template

Description of the issue

My Android build workflow is failing due to the following reason:

FAILURE: Build failed with an exception.

  • What went wrong:

Execution failed for task ‘:app:transformClassesWithMultidexlistForStagingRelease’.

> com.android.build.api.transform.TransformException: Error while generating the main dex list.

Failed to build Android platform, error: exit status 1

It compiles locally through “flutter build apk --release --flavor staging” and through the Bitrise CLI using the same workflow.

I followed the instruction to delete my $HOME/.gradle directory and it produced the same results.


Where did the issue happen?

Bitrise.io: Default stack - Hybrid Visual Studio for Mac, installed on macOS 10.13 (High Sierra), set to the Stable channel.

Which build Step causes the issue and which version of the step?

The build fails on: flutter-build@0.9.2


  • Does a “Rebuild” help? (You can trigger a rebuild from the Build’s page, by clicking the “Rebuild” button in the top right corner of a finished build) : NO
  • Does a rebuild without caches help? (You can remove the Cache:Pull and Cache:Push steps temporarily to not to use the cache, or you can delete all the caches on the Settings tab of the app. : NO
  • Does the issue happen sporadically, or every time? : Every time
  • Does upgrading the build Step to the latest version help? : NO
  • When did the issue start? : When setting ‘minifyEnabled false’ in the Android build.gradle the issue occurs. If I set it to true the workflow completes, but then my app crashes with this build, and I can only run it when it is false.

Local reproduction

Can it be reproduced on your own Mac/PC by following our local debug guide? Please follow at least the first section (“Testing with a full clean git clone”) to make sure to test the state of the code what bitrise.io will get when it does a git clone in the clean environment! If possible please note which sections you tried.

Have performed the local test through the Bitrise CLI as described above.

Local reproduction: Linux / Android (docker based) stack builds

Can it be reproduced by running the build locally, after doing a new git clone of the repository into the /tmp directory and running the build from there with the Bitrise CLI ( Bitrise CLI )? If no, can it be reproduced with Docker (using the same docker images / environment we use on bitrise.io)? Related guide: Redirecting… .

Reproduced locally - no.
Have not used Docker.

Build log

Please copy paste the build’s bitrise.io URL here (or if the issue happens somewhere else then the full logs), or if you can’t share the url / log here then send the url or full log through a private channel (e.g. email - Contact us ), with a link to the related Discuss issue.

Hello there!

This error comes up when you mix dependency versions, you should check your dependency declarations, and If you can, please check out this thread: https://stackoverflow.com/questions/50205825/android-studio-error-while-generating-the-main-dex-list

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