Blondy314
Blondy314

Reputation: 771

flutter build error - merging dex archives

I upgraded flutter today (flutter update) and the packages (flutter packages update) and since my app does not build.

This is the output I get (after trying to change the sdk from 27 to 28 and clean)

I would appreciate your help.

Launching lib\main.dart on in debug mode...

Initializing gradle... Resolving dependencies... Gradle task 'assembleDebug'... ********************************************************* WARNING: This version of device_info will break your Android build if it or its dependencies aren't compatible with AndroidX. See hfor more information on the problem and how to fix it. This warning prints for all Android build failures. The real root cause of the error may be unrelated. ********************************************************* D8: Program type already present: android.support.v4.app.INotificationSideChannel$Stub$Proxy

FAILURE: Build failed with an exception.

BUILD FAILED in 37s Finished with error: Gradle task assembleDebug failed with exit code 1

Upvotes: 0

Views: 2773

Answers (1)

Alejandro Garcia
Alejandro Garcia

Reputation: 259

Original answer by Yuri Misyac


  1. Enable multidex.

Open {your flutter project}/android/app/build.gradle and add following lines.

defaultConfig {
  ...

  multiDexEnabled true // Add this line
}

and

dependencies {
  ...

  implementation 'com.android.support:multidex:1.0.3' // Add this line
}
  1. Migrate to AndroidX.

Open {your flutter project}/android/gradle.properties and add following lines.

...  
android.useAndroidX=true // Add this line
android.enableJetifier=true //Add this line


More info:

Upvotes: 11

Related Questions