Flutter Unable to merge dex
I'm using last version of flutter.
Error :
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
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUİLD FAILED in 3s
Finished with error: Gradle build failed: 1
pubspec.yaml dependencies, using firebase_auth ^0.5.20 :
dependencies:
flutter:
sdk: flutter
intl: ^0.15.7
cloud_firestore: ^0.7.3
firebase_database: ^1.0.4
cached_network_image: ^0.4.2
firebase_auth: ^0.5.20
cupertino_icons: ^0.1.2
android app build.gradle default config:
android{
defaultConfig {
applicationId "com.example.flutterapp"
minSdkVersion 21
targetSdkVersion 27
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
}
Try adding the dependency as well
...
android {
...
defaultConfig {
...
multiDexEnabled true
}
...
}
...
dependencies {
implementation 'com.android.support:multidex:1.0.3' // use latest version
...
}
...
See also
https://github.com/flutter/flutter/issues/20747#issuecomment-414126225
https://github.com/flutter/flutter/issues/21009
Error :
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
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUİLD FAILED in 3s
Finished with error: Gradle build failed: 1
pubspec.yaml dependencies, using firebase_auth ^0.5.20 :
dependencies:
flutter:
sdk: flutter
intl: ^0.15.7
cloud_firestore: ^0.7.3
firebase_database: ^1.0.4
cached_network_image: ^0.4.2
firebase_auth: ^0.5.20
cupertino_icons: ^0.1.2
android app build.gradle default config:
android{
defaultConfig {
applicationId "com.example.flutterapp"
minSdkVersion 21
targetSdkVersion 27
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
}
Try adding the dependency as well
...
android {
...
defaultConfig {
...
multiDexEnabled true
}
...
}
...
dependencies {
implementation 'com.android.support:multidex:1.0.3' // use latest version
...
}
...
See also
https://github.com/flutter/flutter/issues/20747#issuecomment-414126225
https://github.com/flutter/flutter/issues/21009
Comments
Post a Comment