0
votes

Note: Recompile with -Xlint:deprecation for details. D8: Program type already present: android.support.v4.os.ResultReceiver$MyResultReceiver

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

    com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes. Program type already present: android.support.v4.os.ResultReceiver$MyResultReceiver

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 8s ******************************************************************************************* The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app. See https:/goo.gl/CP92wY for more information on the problem and how to fix it. ******************************************************************************************* Finished with error: Gradle task assembleDebug failed with exit code 1

in my pubspec.yaml file

dependencies: flutter: sdk: flutter flutter_localizations: sdk: flutter

# The following adds the Cupertino Icons font to your application.

Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^0.1.2 image_picker: ^0.4.12+1 image_cropper:

^1.0.1 http: ^0.12.0+1 sqflite: ^1.1.3 path_provider: ^0.5.0+1
rxdart: ^0.21.0 share: ^0.6.0+1 shared_preferences: ^0.5.1+2
flutter_svg: ^0.12.1 material_search: ^0.2.8 flushbar: ^1.3.0
connectivity: ^0.4.3+1 flutter_bloc: ^0.9.1 bloc: ^0.11.2 dio: ^2.1.3

2

2 Answers

0
votes

its right in the warning message

org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71

update your kotlin plugin in the gradle file to 1.3.0

0
votes

I had to upgrade my kotlin version to something later - I chose 1.3.60 and my gradle version to 3.5.2 in my android-level build.gradle:

// android/build.gradle
buildscript {
    ext.kotlin_version = '1.3.60'
    repositories {
        google() // Google's Maven repository
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.3' // Google Services plugin
    }
}

I then had also to upgrade my gradle distribution url:

// android/gradle/wrapper/gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

I was able to successfully flutter run after changing these.