OneSignal / react-native-onesignal

React Native Library for OneSignal Push Notifications Service
Other
1.56k stars 368 forks source link

[Bug]: Dependency problem while adding onesignal to an existing react native project #1710

Open Yash-Goyal007 opened 1 month ago

Yash-Goyal007 commented 1 month ago

What happened?

I'm integrating OneSignal into my React Native application, but I'm encountering a Firebase dependency conflict error when trying to make a debug build. My React Native version is 0.62.3, Gradle version is 5.5, Google Services version is 4.3.3, and the conflicting Firebase version is 23.4.1. I'm also using "@react-native-firebase/app": "^16.5.0" and "@react-native-firebase/crashlytics": "^16.5.0" as app dependencies. I've tried removing all Firebase-dependent code and running OneSignal, but the dependency conflict error persists. PS: I have added my build.gradle file config build.gradle.txt

Steps to reproduce?

Just adding onesignal sdk by following the official documentation is enough for reproducing the issue.

What did you expect to happen?

I expected the app to work normally after adding one signal sdk and send push notifications through one signal sdk.

React Native OneSignal SDK version

5.2.0

Which platform(s) are affected?

Relevant log output

* What went wrong:
Could not determine the dependencies of task ':app:preDebugBuild'.
> In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[19.0.0, 23.4.99]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.

  Dependency failing: com.onesignal:notifications:5.1.8 -> com.google.firebase:firebase-messaging@[19.0.0, 23.4.99], but firebase-messaging version was 23.4.1.

  The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the artifact with the issue.
  -- Project 'app' depends onto com.google.firebase:firebase-messaging@{strictly 23.4.1}
  -- Project 'app' depends onto com.onesignal:OneSignal@{strictly 5.1.8}
  -- Project 'app' depends onto com.onesignal:notifications@{strictly 5.1.8}
  -- Project 'app' depends on project 'react' which depends onto com.onesignal:OneSignal@5.1.8

  For extended debugging info execute Gradle from the command line with ./gradlew --info :app:assembleDebug to see the dependency paths to the artifact. This error message came from the google-services Gradle plugin, report issues at https://github.com/google/play-services-plugins and disable by adding "googleServices { disableVersionCheck = false }" to your build.gradle file.

Code of Conduct

jkasten2 commented 1 month ago

@Yash-Goyal007 I believe this is a bug the google-services Gradle plugin. Can you try updating it to the latest version?

Yash-Goyal007 commented 1 month ago

I tried updating google services gradle plugin but still the same error persists.

jkasten2 commented 3 weeks ago

@Yash-Goyal007 could you share a project reproducing the build issue?