Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
fdobre opened this issue Dec 5, 2022 · 26 comments
Open

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

fdobre opened this issue Dec 5, 2022 · 26 comments

Comments

@fdobre
Copy link

fdobre commented Dec 5, 2022

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
Copy link
Author

fdobre commented Dec 5, 2022

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.

@Etaliya
Copy link

Etaliya commented Jan 9, 2023

Any update in this issue?

@fdobre
Copy link
Author

fdobre commented Jan 10, 2023

@Etaliya
Copy link

Etaliya commented Jan 10, 2023

there is no new progress in StackOverflow also @fdobre

@Solly74
Copy link
Contributor

Solly74 commented Jan 10, 2023

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

@fdobre
Copy link
Author

fdobre commented Jan 10, 2023

@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

@Etaliya
Copy link

Etaliya commented Jan 11, 2023

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.

@MinaSamir11
Copy link
Owner

@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
Copy link
Owner

@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'

@Solly74
Copy link
Contributor

Solly74 commented Jan 12, 2023

@MinaSamir11 done :)

@joZephhh
Copy link

joZephhh commented Feb 1, 2023

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

Thanks!

@ahmedbnr
Copy link

ahmedbnr commented Feb 3, 2023

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."

@Etaliya
Copy link

Etaliya commented Feb 3, 2023

@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"

@joZephhh
Copy link

joZephhh commented Feb 4, 2023

@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!

@MinaSamir11
Copy link
Owner

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.

@joZephhh
Copy link

Hello @MinaSamir11 !

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

@bhandanyan-nomad
Copy link

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

@MinaSamir11
Copy link
Owner

Hello @MinaSamir11 !

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

the new public version is available now V4.3.1

@zainulabdeen4
Copy link

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)

@MinaSamir11
Copy link
Owner

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

@supmanyu
Copy link

supmanyu commented Apr 12, 2023

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

@iamchrispham
Copy link

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.

@Gaganesh
Copy link

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.

@Agastya909
Copy link

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

@supmanyu
Copy link

supmanyu commented Jun 7, 2023

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.

@w3company-leo
Copy link

nothing work

any solution????

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

14 participants