6
votes

after adding

location: ^1.4.1

to my dependencies in 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
  rxdart: ^0.20.0
  http: ^0.12.0
  date_format: ^1.0.5
  intl: ^0.15.7
  fluttertoast: ^2.2.3
  location: ^1.4.1

I do Packages get, and everything is fine, but when I try to build it, the app crashes with a message:

Launching lib\main.dart on Lenovo K33a48 in debug mode... Initializing gradle... Resolving dependencies... Gradle task 'assembleDebug'... D8: Program type already present: android.support.v4.app.INotificationSideChannel

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: "Here goes the list of all jar archives" Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes. Program type already present: android.support.v4.app.INotificationSideChannel

  • 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 18s Finished with error: Gradle task assembleDebug failed with exit code 1

My targetSdk is 28. I use Android Studio 3.2.1 Help would be very much appreciated!

1
Thank you @GünterZöchbauer, I've learnt how to access android dependency tree based on the first link, but enforcing all the suggested resolution strategies by the compiler was not enough to solve the problem. At the end I got strange error. I've noticed that location plugin 1.4.1 by Lyokone, used together with fluttertoast plugin 2.2.3 caused this issue. It's only after updating fluttertoast to most recent version 2.2.6 (this version is published yesterday), the issue was resolved. Weirdly, the issue was present only on pc computers, not on macbook pros. - miloss
@miloss did u solve that issue. I see the same problem. - Ride Sun
No @RideSun , I wasn't able to solve it that way. Plugin update solved the problem. - miloss

1 Answers

-1
votes

I'm unable to replicate the behavior you've reported. The issue seems to have been resolved by a plugin update as you've mentioned in the comments. Running flutter clean should solve most conflicts caused in the dependencies cache.