After upgrading react-native-wonderpush the following error is showing at android build:
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)
It seems that react-native-wonderpush
is using com.google.android.play.core
version 2.0.0
and top 2 react-native libraries used for app review/rating use older versions of that module. Tried both react-native-store-review
and react-native-in-app-review
latest versions.
Is there any workaround that could be applied in gradle file and keep the rating working?
I've tried:
implementation(project(':react-native-store-review')) {
exclude group: 'com.google.android.play', module: 'core'
}
But metro is showing:
Exception in HostObject::get for prop 'RNStoreReview': java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/play/core/tasks/Task;, js engine: hermes
Dependecies:
"react-native-store-review": "0.2.1",
"react-native-wonderpush": "^2.2.4",
System:
OS: macOS 13.0.1
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 61.95 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
Any solution or workaround will be greatly appreciated.
Issue has also been logged here:
https://github.com/MinaSamir11/react-native-in-app-review/issues/136
https://github.com/oblador/react-native-store-review/issues/71
https://github.com/wonderpush/react-native-wonderpush/issues/26
Update using latest react-native-wonderpush(2.2.5) and react-native-in-app-review (4.1.1) output of ./gradlew :app:dependencies >> deps.txt
+--- com.wonderpush:wonderpush-android-sdk:4.3.2
| +--- androidx.core:core:1.0.0 -> 1.7.0 (*)
| +--- androidx.localbroadcastmanager:localbroadcastmanager:1.0.0 (*)
| +--- androidx.constraintlayout:constraintlayout:1.1.3 -> 2.1.3 (*)
| +--- androidx.cardview:cardview:1.0.0 (*)
| +--- com.google.dagger:dagger:2.24 -> 2.41
| | \--- javax.inject:javax.inject:1
| +--- javax.inject:javax.inject:1
| +--- io.reactivex.rxjava2:rxjava:2.1.14
| | \--- org.reactivestreams:reactive-streams:1.0.2
| +--- io.reactivex.rxjava2:rxandroid:2.0.2
| | \--- io.reactivex.rxjava2:rxjava:2.1.9 -> 2.1.14 (*)
| +--- com.squareup.picasso:picasso:2.8
| | +--- com.squareup.okhttp3:okhttp:3.10.0 -> 4.9.3 (*)
| | +--- androidx.annotation:annotation:1.0.0 -> 1.3.0
| | \--- androidx.exifinterface:exifinterface:1.0.0 -> 1.2.0
| | \--- androidx.annotation:annotation:1.1.0 -> 1.3.0
| +--- com.squareup.okhttp3:okhttp:3.14.9 -> 4.9.3 (*)
| +--- androidx.webkit:webkit:1.4.0
| | +--- androidx.annotation:annotation:1.1.0 -> 1.3.0
| | \--- androidx.core:core:1.1.0 -> 1.7.0 (*)
| \--- com.google.android.play:review:2.0.0
| +--- com.google.android.gms:play-services-basement:16.0.1 -> 18.1.0 (*)
| +--- com.google.android.gms:play-services-tasks:16.0.1 -> 18.0.1 (*)
| \--- com.google.android.play:core-common:2.0.0
| +--- com.google.android.gms:play-services-basement:16.0.1 -> 18.1.0 (*)
| \--- com.google.android.gms:play-services-tasks:16.0.1 -> 18.0.1 (*)
+--- project :react-native-in-app-review
| +--- com.facebook.react:react-native:+ -> 0.69.6 (*)
| +--- com.google.android.play:core:1.9.0
| \--- com.google.android.gms:play-services-base:17.5.0 -> 18.0.1 (*)
Tried the solution from here: https://stackoverflow.com/a/72422316/1979861
implementation ('com.wonderpush:wonderpush-android-sdk:4.3.2') {
exclude group: 'com.google.android.play', module: 'review'
}
but that doesn't seem to have any effect with the above string or with project(':react-native-wonderpush')
with exclusion or review
, core
, or core-common
modules.
If there is no fix in gradle file, would it be possible to fork any of the rating libraries or wonderpush and adjust the dependencies there? If yes what would be the changes in the fork?
You can fork the react-native-in-app-review repo and 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