react-native-in-app-review icon indicating copy to clipboard operation
react-native-in-app-review copied to clipboard

Android Error Duplicate class com.google.android.play.core.common

Open fdobre opened this issue 2 years ago • 31 comments

Duplicate class com.google.android.play.core.common.IntentSenderForResultStarter found in modules jetified-core-1.9.0-runtime (com.google.android.play:core:1.9.0) and jetified-core-common-2.0.0-runtime (com.google.android.play:core-common:2.0.0)
    Duplicate class com.google.android.play.core.common.LocalTestingException found in modules jetified-core-1.9.0-runtime (com.google.android.play:core:1.9.0) and jetified-core-common-2.0.0-runtime (com.google.android.play:core-common:2.0.0)
    Duplicate class com.google.android.play.core.common.PlayCoreDialogWrapperActivity found in modules jetified-core-1.9.0-runtime (com.google.android.play:core:1.9.0) and jetified-core-common-2.0.0-runtime (com.google.android.play:core-common:2.0.0)
    Duplicate class com.google.android.play.core.listener.StateUpdatedListener found in modules jetified-core-1.9.0-runtime (com.google.android.play:core:1.9.0) and jetified-core-common-2.0.0-runtime (com.google.android.play:core-common:2.0.0)
    Duplicate class com.google.android.play.core.review.ReviewInfo found in modules jetified-core-1.9.0-runtime (com.google.android.play:core:1.9.0) and jetified-review-2.0.0-runtime (com.google.android.play:review:2.0.0)
    Duplicate class com.google.android.play.core.review.ReviewManager found in modules jetified-core-1.9.0-runtime (com.google.android.play:core:1.9.0) and jetified-review-2.0.0-runtime (com.google.android.play:review:2.0.0)
    Duplicate class com.google.android.play.core.review.ReviewManagerFactory found in modules jetified-core-1.9.0-runtime (com.google.android.play:core:1.9.0) and jetified-review-2.0.0-runtime (com.google.android.play:review:2.0.0)
    Duplicate class com.google.android.play.core.review.testing.FakeReviewManager found in modules jetified-core-1.9.0-runtime (com.google.android.play:core:1.9.0) and jetified-review-2.0.0-runtime (com.google.android.play:review:2.0.0)
"react-native-in-app-review": "4.1.1",
 "react-native-webview": "^11.25.0",
 "react-native-wonderpush": "^2.2.4",
    OS: macOS 13.0.1
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 31.38 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.10.0 - ~/.nvm/versions/node/v16.10.0/bin/node
    Yarn: 1.22.18 - /usr/local/bin/yarn
    npm: 7.24.0 - ~/.nvm/versions/node/v16.10.0/bin/npm
    Watchman: 2022.03.21.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.1, iOS 16.1, macOS 13.0, tvOS 16.1, watchOS 9.1
    Android SDK:
      API Levels: 26, 27, 28, 29, 30, 31, 32, 33
      Build Tools: 27.0.3, 28.0.3, 29.0.0, 29.0.2, 29.0.3, 30.0.0, 30.0.2, 30.0.3, 31.0.0, 31.0.0, 32.0.0, 32.1.0, 33.0.0, 33.0.0, 33.0.0, 33.0.0, 33.0.1
      System Images: android-26 | Intel x86 Atom_64, android-26 | Google Play Intel x86 Atom, android-27 | Intel x86 Atom_64, android-27 | Google Play Intel x86 Atom, android-28 | Intel x86 Atom, android-28 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom_64, android-28 | Google Play Intel x86 Atom, android-28 | Google X86_ARM Intel x86 Atom, android-29 | Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom_64, android-29 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom_64, android-30 | Google APIs Intel x86 Atom, android-30 | Google APIs Intel x86 Atom_64, android-30 | Google Play Intel x86 Atom, android-30 | Google Play Intel x86 Atom_64, android-31 | Intel x86 Atom_64, android-31 | Google APIs ARM 64 v8a, android-31 | Google APIs Intel x86 Atom_64, android-31 | Google Play ARM 64 v8a, android-31 | Google Play Intel x86 Atom_64, android-32 | Google APIs Intel x86 Atom_64, android-32 | Google Play Intel x86 Atom_64, android-33 | Google APIs Intel x86 Atom_64, android-33 | Google Play Intel x86 Atom_64
      Android NDK: Not Found
  IDEs:
    Android Studio: 2021.3 AI-213.7172.25.2113.9014738
    Xcode: 14.1/14B47b - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.11 - /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: ^18.0.0 => 18.2.0 
    react-native: 0.69.6 => 0.69.6 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

```   minSdkVersion = 26
        compileSdkVersion = 33
        targetSdkVersion = 33
        buildToolsVersion = "33.0.1"
        androidXCore = "1.0.2"
        androidXAnnotation = "1.2.0"
        androidXBrowser = "1.3.0"

fdobre avatar Dec 05 '22 14:12 fdobre

On my side to support Android 13 notifications and upgrade of wonderpush is required and somehow react-native-in-app-review triggers a build crash.

Problem is that wonderpush is using com.google.android.play:core-common:2.0.0

Any suggestion how to apply an workaround or a fork will be greatly appreciated.

fdobre avatar Dec 05 '22 14:12 fdobre

Any update in this issue?

Etaliya avatar Jan 09 '23 13:01 Etaliya

FYI: I added a question and attached a bounty to it here: https://stackoverflow.com/questions/74692599/duplicate-class-in-com-google-android-play-core-in-common-and-review-modules @Etaliya @MinaSamir11

fdobre avatar Jan 10 '23 08:01 fdobre

there is no new progress in StackOverflow also @fdobre

Etaliya avatar Jan 10 '23 08:01 Etaliya

You can modify the build gradle file in the android project. Replace line 56 with implementation 'com.google.android.play:review:2.0.0'

Then inside the AppReviewModule.java replace line 18 with import com.google.android.gms.tasks.Task;

This will work with the wonderpush library as it is no longer making use of the play core library but instead using the review library only.

I have forked it here: https://github.com/Solly74/react-native-in-app-review

Solly74 avatar Jan 10 '23 14:01 Solly74

@MinaSamir11 please let us know if the code from the above fork looks OK from your perspective or if there is anything to be improved. If you think it's OK we could create a pull request. I have tested the fork and it appears to work OK. CC: @Etaliya @Solly74

fdobre avatar Jan 10 '23 14:01 fdobre

You can modify the build gradle file in the android project. Replace line 56 with implementation 'com.google.android.play:review:2.0.0'

Then inside the AppReviewModule.java replace line 18 with import com.google.android.gms.tasks.Task;

This will work with the wonderpush library as it is no longer making use of the play core library but instead using the review library only.

I have forked it here: https://github.com/Solly74/react-native-in-app-review

Thanks @Solly74 , It's work for me.

Etaliya avatar Jan 11 '23 08:01 Etaliya

@MinaSamir11 please let us know if the code from the above fork looks OK from your perspective or if there is anything to be improved. If you think it's OK we could create a pull request.

Great Sol.

MinaSamir11 avatar Jan 11 '23 09:01 MinaSamir11

@Solly74
Doing Great, Can you please make a pull request of your changes to merge it and please update this -> implementation 'com.google.android.play:review:2.0.1'

MinaSamir11 avatar Jan 11 '23 09:01 MinaSamir11

@MinaSamir11 done :)

Solly74 avatar Jan 12 '23 12:01 Solly74

Is this has been released ? I've still the issue with 4.2.1 😕

Thanks!

joZephhh avatar Feb 01 '23 20:02 joZephhh

still having the same issue when trying to run a react native project... the error : "Duplicate class com.google.android.play.core.common.IntentSenderForResultStarter found in modules jetified-core-1.9.0-runtime (com.google.android.play:core:1.9.0) and jetified-core-common-2.0.2-runtime (com.google.android.play:core-common:2.0.2) Duplicate class com.google.android.play.core.common.LocalTestingException found in modules jetified-core-1.9.0-runtime (com.google.android.play:core:1.9.0) and jetified-core-common-2.0.2-runtime (com.google.android.play:core-common:2.0.2) Duplicate class com.google.android.play.core.common.PlayCoreDialogWrapperActivity found in modules jetified-core-1.9.0-runtime (com.google.android.play:core:1.9.0) and jetified-core-common-2.0.2-runtime (com.google.android.play:core-common:2.0.2) Duplicate class com.google.android.play.core.listener.StateUpdatedListener found in modules jetified-core-1.9.0-runtime (com.google.android.play:core:1.9.0) and jetified-core-common-2.0.2-runtime (com.google.android.play:core-common:2.0.2) Duplicate class com.google.android.play.core.review.ReviewInfo found in modules jetified-core-1.9.0-runtime (com.google.android.play:core:1.9.0) and jetified-review-2.0.1-runtime (com.google.android.play:review:2.0.1) Duplicate class com.google.android.play.core.review.ReviewManager found in modules jetified-core-1.9.0-runtime (com.google.android.play:core:1.9.0) and jetified-review-2.0.1-runtime (com.google.android.play:review:2.0.1) Duplicate class com.google.android.play.core.review.ReviewManagerFactory found in modules jetified-core-1.9.0-runtime (com.google.android.play:core:1.9.0) and jetified-review-2.0.1-runtime (com.google.android.play:review:2.0.1) Duplicate class com.google.android.play.core.review.testing.FakeReviewManager found in modules jetified-core-1.9.0-runtime (com.google.android.play:core:1.9.0) and jetified-review-2.0.1-runtime (com.google.android.play:review:2.0.1)

Go to the documentation to learn how to Fix dependency resolution errors."

ahmedbnr avatar Feb 03 '23 11:02 ahmedbnr

@ahmedbnr @joZephhh Community has not released the latest version with this fixed but you can use the repo URL instead of the version.

"react-native-in-app-review": "https://github.com/MinaSamir11/react-native-in-app-review.git"

Etaliya avatar Feb 03 '23 12:02 Etaliya

@Etaliya Good to know thanks! I was able to test and it's fixes the issue. However have you any idea on a possible ETA for a release ? As I would be more confident to relies on a "fixed" version! Thanks!

joZephhh avatar Feb 04 '23 10:02 joZephhh

Sorry for the late response.

The new release is now available, follow the new readme.md installation steps. https://github.com/MinaSamir11/react-native-in-app-review/releases/tag/v4.3.1

For the public registry, the new release will be available in 10 days.

MinaSamir11 avatar Feb 05 '23 18:02 MinaSamir11

Hello @MinaSamir11 !

Any update on the public registry release ? Thanks a lot! 💪

joZephhh avatar Feb 17 '23 13:02 joZephhh

+1 looking to incorporate this package, running into the issue and would love to use an official version

bhandanyan-nomad avatar Feb 17 '23 19:02 bhandanyan-nomad

Hello @MinaSamir11 !

Any update on the public registry release ? Thanks a lot! 💪

the new public version is available now V4.3.1

MinaSamir11 avatar Mar 06 '23 23:03 MinaSamir11

getting these error on version v4.3.3

> Duplicate class com.google.android.play.core.common.IntentSenderForResultStarter found in modules jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0) and jetified-core-common-2.0.2-runtime (com.google.android.play:core-common:2.0.2) Duplicate class com.google.android.play.core.common.LocalTestingException found in modules jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0) and jetified-core-common-2.0.2-runtime (com.google.android.play:core-common:2.0.2) Duplicate class com.google.android.play.core.common.PlayCoreDialogWrapperActivity found in modules jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0) and jetified-core-common-2.0.2-runtime (com.google.android.play:core-common:2.0.2) Duplicate class com.google.android.play.core.listener.StateUpdatedListener found in modules jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0) and jetified-core-common-2.0.2-runtime (com.google.android.play:core-common:2.0.2) Duplicate class com.google.android.play.core.review.ReviewInfo found in modules jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0) and jetified-review-2.0.1-runtime (com.google.android.play:review:2.0.1) Duplicate class com.google.android.play.core.review.ReviewManager found in modules jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0) and jetified-review-2.0.1-runtime (com.google.android.play:review:2.0.1) Duplicate class com.google.android.play.core.review.ReviewManagerFactory found in modules jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0) and jetified-review-2.0.1-runtime (com.google.android.play:review:2.0.1) Duplicate class com.google.android.play.core.review.testing.FakeReviewManager found in modules jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0) and jetified-review-2.0.1-runtime (com.google.android.play:review:2.0.1)

zainulabdeen4 avatar Mar 20 '23 14:03 zainulabdeen4

getting these error on version v4.3.3

> Duplicate class com.google.android.play.core.common.IntentSenderForResultStarter found in modules jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0) and jetified-core-common-2.0.2-runtime (com.google.android.play:core-common:2.0.2) Duplicate class com.google.android.play.core.common.LocalTestingException found in modules jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0) and jetified-core-common-2.0.2-runtime (com.google.android.play:core-common:2.0.2) Duplicate class com.google.android.play.core.common.PlayCoreDialogWrapperActivity found in modules jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0) and jetified-core-common-2.0.2-runtime (com.google.android.play:core-common:2.0.2) Duplicate class com.google.android.play.core.listener.StateUpdatedListener found in modules jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0) and jetified-core-common-2.0.2-runtime (com.google.android.play:core-common:2.0.2) Duplicate class com.google.android.play.core.review.ReviewInfo found in modules jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0) and jetified-review-2.0.1-runtime (com.google.android.play:review:2.0.1) Duplicate class com.google.android.play.core.review.ReviewManager found in modules jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0) and jetified-review-2.0.1-runtime (com.google.android.play:review:2.0.1) Duplicate class com.google.android.play.core.review.ReviewManagerFactory found in modules jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0) and jetified-review-2.0.1-runtime (com.google.android.play:review:2.0.1) Duplicate class com.google.android.play.core.review.testing.FakeReviewManager found in modules jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0) and jetified-review-2.0.1-runtime (com.google.android.play:review:2.0.1)

Please mention your working env

MinaSamir11 avatar Mar 20 '23 15:03 MinaSamir11

Hi @MinaSamir11, i'm facing the same issue that @zainulabdeen4 faced. env information is below:

System:
    OS: macOS 13.2.1
    CPU: (8) arm64 Apple M1
    Memory: 82.36 MB / 8.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 14.17.0 - ~/.nvm/versions/node/v14.17.0/bin/node
    Yarn: 1.22.18 - ~/.nvm/versions/node/v14.17.0/bin/yarn
    npm: 6.14.13 - ~/.nvm/versions/node/v14.17.0/bin/npm
    Watchman: 2023.04.10.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /Users/edufund/.rvm/gems/ruby-2.7.6/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.1, iOS 16.1, macOS 13.0, tvOS 16.1, watchOS 9.1
    Android SDK:
      API Levels: 30, 31, 32, 33
      Build Tools: 29.0.2, 30.0.2, 30.0.3, 31.0.0, 32.0.0, 32.1.0
      System Images: android-30 | Intel x86 Atom_64, android-30 | Google APIs Intel x86 Atom, android-30 | Google Play ARM 64 v8a, android-31 | Google APIs ARM 64 v8a, android-32 | Google APIs ARM 64 v8a, android-33 | Google APIs ARM 64 v8a
      Android NDK: Not Found
  IDEs:
    Android Studio: 2022.1 AI-221.6008.13.2211.9619390
    Xcode: 14.1/14B47b - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.15 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2 
    react-native: 0.64.3 => 0.64.
    react-native-in-app-review: "^4.3.3",
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

supmanyu avatar Apr 12 '23 10:04 supmanyu

I would check against any possible libraries that are using similar classes. I ran into this issue as well, but was ameliorated when I removed react-native-rate. You should run ./gradlew app:dependencies >> deps.txt and check the dependency tree for any conflicting versions/duplicate classes.

iamchrispham avatar Apr 13 '23 17:04 iamchrispham

I have tried version 4.3.3 & 4.3.1 , in both version i am getting same issue above. @MinaSamir11 do you any suggestion for it.

Gaganesh avatar May 25 '23 13:05 Gaganesh

I have the same issue, so thought of excluding the conflicting dependencies from the package by this piece of code implementation "com.google.android.play:core:1.10.0" implementation(project(':react-native-in-app-review')) { exclude group: 'com.google.android.play', module: 'core-common' exclude group: 'com.google.android.play', module: 'review' }

this resolves the dependency issue, InAppReview.isAvailable(); this returns true but await InAppReview.RequestInAppReview(); this causes the following issue : image

Agastya909 avatar Jun 07 '23 13:06 Agastya909

According to this release note by the android dev team, the play:core library has been split up into individual libraries.

Removing implementation "com.google.android.play:core:1.10.0" from the gradle dependencies fixes the problem, and only the libraries that are in use should be declared as a dependency.

for e.g, implementation 'com.google.android.play:review:2.0.1' in our case is required, and i had both libraries declared as a dependency in my app-level gradle file, which was causing the duplicate class errors.

Note: make sure you are declaring all the libraries that are in use by your project, since i was also using in-app updates natively for informing users when an app-update was available on the play store.

supmanyu avatar Jun 07 '23 13:06 supmanyu

nothing work

any solution????

w3company-leo avatar Aug 01 '23 05:08 w3company-leo

still facing with this issue.

CMLCNL avatar Aug 15 '24 12:08 CMLCNL