fluttercommunity / flutter_contacts

Contacts Service - A Flutter plugin to retrieve and manage contacts on Android and iOS devices. Maintainer: @lukasgit
https://pub.dev/packages/contacts_service
MIT License
153 stars 69 forks source link

Build failed with an exception - Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug' #75

Closed devmithunnath closed 5 years ago

devmithunnath commented 5 years ago

I'm working on a fresh install of Flutter. All I did was adding contact services to the pubspec.yaml file and when I try to run it throws build error.

pubspec.yaml

dependencies:
  flutter:
    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
  simple_permissions: ^0.1.9
  contacts_service: ^0.2.4

Error

Launching lib/main.dart on SM G950W in debug mode...
Initializing gradle...
Resolving dependencies...
Running Gradle task 'assembleDebug'...
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: /home/mithunnath/IdeaProjects/fluttercontactsapp/build/app/intermediates/transforms/dexBuilder/debug/28.jar, /home/mithunnath/IdeaProjects/fluttercontactsapp/build/app/intermediates/transforms/dexBuilder/debug/5.jar, /home/mithunnath/IdeaProjects/fluttercontactsapp/build/app/intermediates/transforms/dexBuilder/debug/40.jar, /home/mithunnath/IdeaProjects/fluttercontactsapp/build/app/intermediates/transforms/dexBuilder/debug/58.jar, /home/mithunnath/IdeaProjects/fluttercontactsapp/build/app/intermediates/transforms/dexBuilder/debug/49.jar, /home/mithunnath/IdeaProjects/fluttercontactsapp/build/app/intermediates/transforms/dexBuilder/debug/34.jar, /home/mithunnath/IdeaProjects/fluttercontactsapp/build/app/intermediates/transforms/dexBuilder/debug/64.jar, /home/mithunnath/IdeaProjects/fluttercontactsapp/build/app/intermediates/transforms/dexBuilder/debug/9.jar, /home/mithunnath/IdeaProjects/fluttercontactsapp/build/app/intermediates/transforms/dexBuilder/debug/61.jar, /home/mithunnath/IdeaProjects/fluttercontactsapp/build/app/intermediates/transforms/dexBuilder/debug/37.jar, /home/mithunnath/IdeaProjects/fluttercontactsapp/build/app/intermediates/transforms/dexBuilder/debug/55.jar, /home/mithunnath/IdeaProjects/fluttercontactsapp/build/app/intermediates/transforms/dexBuilder/debug/43.jar, /home/mithunnath/IdeaProjects/fluttercontactsapp/build/app/intermediates/transforms/dexBuilder/debug/25.jar, /home/mithunnath/IdeaProjects/fluttercontactsapp/build/app/intermediates/transforms/dexBuilder/debug/31.jar, /home/mithunnath/IdeaProjects/fluttercontactsapp/build/app/intermediates/transforms/dexBuilder/debug/67.jar, /home/mithunnath/IdeaProjects/fluttercontactsapp/build/app/intermediates/transforms/dexBuilder/debug/46.jar, /home/mithunnath/IdeaProjects/fluttercontactsapp/build/app/intermediates/transforms/dexBuilder/debug/22.jar, /home/mithunnath/IdeaProjects/fluttercontactsapp/build/app/intermediates/transforms/dexBuilder/debug/52.jar, /home/mithunnath/IdeaProjects/fluttercontactsapp/build/app/intermediates/transforms/dexBuilder/debug/15.jar, /home/mithunnath/IdeaProjects/fluttercontactsapp/build/app/intermediates/transforms/dexBuilder/debug/10.jar, /home/mithunnath/IdeaProjects/fluttercontactsapp/build/app/intermediates/transforms/dexBuilder/debug/6.jar, /home/mithunnath/IdeaProjects/fluttercontactsapp/build/app/intermediates/transforms/dexBuilder/debug/7.jar, /home/mithunnath/IdeaProjects/fluttercontactsapp/build/app/intermediates/transforms/dexBuilder/debug/11.jar, /home/mithunnath/IdeaProjects/fluttercontactsapp/build/app/intermediates/transforms/dexBuilder/debug/14.jar, /home/mithunnath/IdeaProjects/fluttercontactsapp/build/app/intermediates/transforms/dexBuilder/debug/3.jar, /home/mithunnath/IdeaProjects/fluttercontactsapp/build/app/intermediates/transforms/dexBuilder/debug/8.jar, /home/mithunnath/IdeaProjects/fluttercontactsapp/build/app/intermediates/transforms/dexBuilder/debug/12.jar, /home/mithunnath/IdeaProjects/fluttercontactsapp/build/app/intermediates/transforms/dexBuilder/debug/4.jar, /home/mithunnath/IdeaProjects/fluttercontactsapp/build/app/intermediates/transforms/dexBuilder/debug/16.jar, /home/mithunnath/IdeaProjects/fluttercontactsapp/build/app/intermediates/transforms/dexBuilder/debug/2.jar, /home/mithunnath/IdeaProjects/fluttercontactsapp/build/app/intermediates/transforms/dexBuilder/debug/13.jar
  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 2s
*******************************************************************************************
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
lukasgit commented 5 years ago

@devmithunnath can you provide us with additional details by running with --scan option? Thanks!

DRM7 commented 5 years ago

I'm getting the same thing. I suspect it is the versions named in the Android/build.gradle but I'm honestly too new at this to be sure. I think the versions 16/25 may need to be more current.

android { compileSdkVersion 28 buildToolsVersion '25.0.3'

defaultConfig {
    minSdkVersion 16
    targetSdkVersion 25
lukasgit commented 5 years ago

@DRM7 were you able to confirm the underlying issue? Thanks

DRM7 commented 5 years ago

I'm sorry. I'm just not experienced enough to prove the issue. I'm still having the problem but I'm unable to ascertain the root cause. Thanks!

sm9i commented 5 years ago

Probably the problem is that the library you rely on share_extend'conflicts with other libraries, api' and androidx.legacy: legacy-support-core-utils: 1.0.0', andandroid.support.v4.app.INotificationSideChannel' conflicts. I also met.

lukasgit commented 5 years ago

@sm9i looking into it, thanks

lukasgit commented 5 years ago

Fixed in PR #87 please upgrade to the latest plugin