SykoB
SykoB

Reputation: 33

Flutter Gradle Task Failed MergeDexDebug

I've been facing this issue for some time now. In my flutter logs, it says that app:mergeDexDebug Failed. Could anyone recommend how to solve this issue? Here's my android manifest.

android {

    compileSdkVersion 29

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.HackathonPolice"
        minSdkVersion 16
        targetSdkVersion 29
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
}

Upvotes: 3

Views: 61

Answers (1)

XtremeDevX
XtremeDevX

Reputation: 1792

A simple fix that I found to have worked is replacing your defaultConfig with this:

defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.HackathonPolice"
        minSdkVersion 16
        targetSdkVersion 29
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        multiDexEnabled true
    }

Upvotes: 3

Related Questions