[Solved] Execution failed for task ‘:app:mergeDexDebug’.

2022/08/07 21:44

Exception

* What went wrong:
Execution failed for task ‘:app:mergeDexDebug’.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html

Solution

Find..\android\app\build.gradle in your Flutter project folder. And add the following lines.

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

dependencies {

implementation “org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version”

implementation ‘com.android.support:multidex:2.0.1’ //enter the latest multidex version

}

声明:未经允许不得进行商业转载,非商业转载请注明出处和链接。

Leave a Reply

Back to top