Build Failed with an Exception – Unable to merge dex

Build Failed with an Exception - Unable to merge dex

Problema:

FAILURE: Build failed with an exception.

* What went wrong:

Execution failed for task ‘:app:transformDexArchiveWithExternalLibsDexMergerForDebug’.

> java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

Solução:

1) Vá até o android/app/build.gradle

2) Adicione o seguinte comando dentro do defaultConfig:

multiDexEnabled true

Ficará algo assim:

defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "me.alexandrefreire.vendas"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }

Deixe uma resposta