# Flutter Android build fails due to multidex error, compiles locally

**URL:** <https://discuss.bitrise.io/t/flutter-android-build-fails-due-to-multidex-error-compiles-locally/8041>\
**Category:** Builds\
**Created:** [February 12, 2019, 11:06am UTC](https://discuss.bitrise.io/t/flutter-android-build-fails-due-to-multidex-error-compiles-locally/8041 "2019-02-12T11:06:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![smccalgan](https://avatars.discourse-cdn.com/v4/letter/s/6de8d8/32.png) [@smccalgan](https://discuss.bitrise.io/u/smccalgan)\
**Post date:** [February 12, 2019, 11:06am UTC](https://discuss.bitrise.io/t/flutter-android-build-fails-due-to-multidex-error-compiles-locally/8041/1 "2019-02-12T11:06:00Z")

</div>

# 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.

## Environment:

**Where did the issue happen?**

[Bitrise.io](http://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

## Reproducibility

- _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](http://devcenter.bitrise.io/caching/about-caching/#downloading-and-deleting-caches)._ : 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](http://discuss.bitrise.io/t/how-to-debug-your-build-locally-it-works-on-my-mac-pc-but-not-on-bitrise-io/392)? 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](http://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](https://www.bitrise.io/cli) )? If no, can it be reproduced with Docker (using the same docker images / environment we use on [bitrise.io](http://bitrise.io))? Related guide: [Running your build locally in Docker](http://devcenter.bitrise.io/docker/run-your-build-locally-in-docker/) ._

Reproduced locally - no.  
Have not used Docker.

## Build log

_Please copy paste the build’s [bitrise.io](http://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](https://www.bitrise.io/contact) ), with a link to the related Discuss issue._

> **[Log in - Bitrise](https://app.bitrise.io/users/sign_in)**
>
> Bringing back the joy of iOS & Android development through automating build, testing and support cycles.

---

<div class="post-metadata">

**Author:** ![fehersanyi-bitrise](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/fehersanyi-bitrise/32/1912_2.png) [@fehersanyi-bitrise](https://discuss.bitrise.io/u/fehersanyi-bitrise)\
**Post date:** [February 14, 2019, 9:58am UTC](https://discuss.bitrise.io/t/flutter-android-build-fails-due-to-multidex-error-compiles-locally/8041/2 "2019-02-14T09:58:26Z")

</div>

> [@smccalgan](#):
>
> Error while generating the main dex list.

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: [gradle - Android Studio: Error while generating the main dex list - Stack Overflow](https://stackoverflow.com/questions/50205825/android-studio-error-while-generating-the-main-dex-list)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/bitrise/original/2X/d/d901cf2aad020f2dd11918afc89ec2089bb87b35.png) [@system](https://discuss.bitrise.io/u/system)\
**Post date:** [March 16, 2019, 9:58am UTC](https://discuss.bitrise.io/t/flutter-android-build-fails-due-to-multidex-error-compiles-locally/8041/3 "2019-03-16T09:58:28Z")

</div>

Closed on March 16, 2019, 9:58am UTC

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