purchases-flutter icon indicating copy to clipboard operation
purchases-flutter copied to clipboard

[Could not build app because of Duplicate of classes in module]

Open dtvtkien opened this issue 2 years ago • 9 comments

‼️ Required data ‼️

Do not remove any of the steps from the template below. If a step is not applicable to your issue, please leave that step empty.

There are a lot of things that can contribute to things not working. Having a very basic understanding of your environment will help us understand your issue faster!

Environment

  • [x] Output of flutter doctor [✓] Flutter (Channel stable, 3.0.5, on macOS 12.4 21F79 darwin-arm, locale en-VN) [✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 13.4.1) [✓] Chrome - develop for the web [✓] Android Studio (version 2021.1) [✓] VS Code (version 1.70.0) [✓] Connected device (3 available) [✓] HTTP Host Availability

  • [x] Version of purchases-flutter: 4.0.0

  • [x] Testing device version: Android API 30

  • [x] How often the issue occurs: every time I use flutter run

  • [ ] Debug logs that reproduce the issue

  • [ ] Steps to reproduce, with a description of expected vs. actual behavior Other information (e.g. stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc.)

Describe the bug

Lot of classes was duplicated between module jetified-amazon-appstore-sdk-3.0.2 & module jetified-in-app-purchasing-2.0.76.

Logs:

  • Duplicate class com.amazon.device.iap.model.UserDataResponse found in modules jetified-amazon-appstore-sdk-3.0.2 (com.amazon.device:amazon-appstore-sdk:3.0.2) and jetified-in-app-purchasing-2.0.76 (in-app-purchasing-2.0.76.jar)
  • Duplicate class com.amazon.device.iap.model.UserDataResponse$RequestStatus found in modules jetified-amazon-appstore-sdk-3.0.2 (com.amazon.device:amazon-appstore-sdk:3.0.2) and jetified-in-app-purchasing-2.0.76 (in-app-purchasing-2.0.76.jar)
  • Go to the documentation to learn how to Fix dependency resolution errors.

Additional context

I have run flutter clean then flutter pub get but it doesn't work.

dtvtkien avatar Aug 08 '22 06:08 dtvtkien

👀 SDKONCALL-86 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!

RCGitBot avatar Aug 08 '22 06:08 RCGitBot

same issue here. Waiting for the fix. Thanks!

uzumaki258 avatar Aug 08 '22 09:08 uzumaki258

Are you upgrading from an alpha/beta version where you had to manually download the amazon jar into the libs folder of your Android project? We used to depend on in-app-purchasing-2.0.76 and we used to require folks to download the jar manually, but we now download the dependencies automatically, so you can remove that .jar from your project.

vegaro avatar Aug 08 '22 09:08 vegaro

No, I have upgraded the dependency from v3.9.5 officially from pub.dev.

dtvtkien avatar Aug 08 '22 09:08 dtvtkien

Sorry, I've checked again and it actually was upgraded from v3.10.0

dtvtkien avatar Aug 08 '22 09:08 dtvtkien

Interesting... Can you paste here your set of dependencies from your pubspec.yaml?

vegaro avatar Aug 08 '22 10:08 vegaro

My set of dependencies:

dependencies:
  flutter:
    sdk: flutter
  # In-App-Purchase & Admob
  google_mobile_ads: ^2.0.0
  app_tracking_transparency: ^2.0.2+4
  flutter_inapp_purchase: ^5.3.1
  # RevenueCat
  purchases_flutter: ^4.0.0

dtvtkien avatar Aug 09 '22 01:08 dtvtkien

I've found that inside build.gradle of flutter_inapp_purchase they are depending on

group 'com.dooboolab.flutterinapppurchase'
version '1.0-SNAPSHOT'
...
dependencies {
    ...
    implementation files('jars/in-app-purchasing-2.0.76.jar')
}

which could cause this conflict.

dtvtkien avatar Aug 09 '22 01:08 dtvtkien

Yes, that's exactly what's happening. Do you need that dependency? Are you using RevenueCat in observer mode? If not, you should remove it from your project and only have RevenueCat's.

That Amazon in-app-purchasing-2.0.76 dependency has been updated to version 3.0.3, which is now distributed in Maven. If they update to use 3.0.3 and remove the jar from their plugin, there won't be any conflicts with ours.

vegaro avatar Aug 09 '22 10:08 vegaro

@dtvtkien and @uzumaki258 were you able to solve this?

aboedo avatar Aug 23 '22 20:08 aboedo

I'm tentatively closing this one out, but let us know if you're still running into issues.

aboedo avatar Sep 06 '22 14:09 aboedo

Hi, maybe it's a bit late, but I've fixed it by doing this:

  1. Removed implementation files('jars/in-app-purchasing-2.0.76.jar')
  2. Added implementation 'com.amazon.device:amazon-appstore-sdk:3.+'

Official sdk docs: https://developer.amazon.com/docs/appstore-sdk/integrate-appstore-sdk.html

nikkolaykolya avatar Aug 17 '23 01:08 nikkolaykolya

Hello i am facing same error and i have same dependency like flutter_inapp_purchase: , purchases_flutter:

i have latest version of both what should i do now?

khushal-chothani avatar Aug 22 '23 12:08 khushal-chothani