-
Notifications
You must be signed in to change notification settings - Fork 374
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
[Bug]: dependency conflict on Android #1545
Comments
@CrashingTheCode thanks for reaching out! We'll investigate this and get back to you as soon as possible. |
I am running into this same issue, I believe it's a "transitive dependency conflict" where I have another package in my react-native project that is pulling in androidx.work:work-runtime, and they have conflicting versions. It's the
And in my case, it's conflicting with:
|
I was able to resolve this by going into my
|
This worked. Thanks @KodyKendall |
For anyone else who comes across this but would like to ensure the use of
Note, I'm not sure if this is the correct way to achieve this as I'm new to the world of ReactNative + Android but its working so far for me (and as it is a minor version bump I'm assuming it should be okay) Hope this helps someone |
Hello all! Just a quick update that we have updated our androidx.work:work-runtime to prefer the latest version, 2.8.1. Version 5.0.3 of the React Native plugin reflects this. Please let us know if you have any additional questions or concerns. |
Hi -- thanks for this, but not sure this is fixed in 5.0.3 as we're still getting the above build error. We use expo managed builds in our workflow so needed the above patch to be put into our
|
Here is config plugin for expo. const { withAppBuildGradle } = require("@expo/config-plugins");
const generateCode = require("@expo/config-plugins/build/utils/generateCode");
// https://github.com/OneSignal/react-native-onesignal/issues/1545
const onesignalAndroidXConflictWorkaroundCode = `
configurations.all {
resolutionStrategy.force 'androidx.work:work-runtime:2.8.1'
resolutionStrategy.force 'androidx.work:work-runtime-ktx:2.8.1'
}
`;
module.exports = (config) => {
return withAppBuildGradle(config, async (config) => {
const addCode = generateCode.mergeContents({
newSrc: onesignalAndroidXConflictWorkaroundCode,
tag: "onesignalAndroidXConflictWorkaroundCode",
src: config.modResults.contents,
anchor: /\s*namespace/i,
comment: "//",
offset: 1,
});
config.modResults.contents = addCode.contents;
return config;
});
}; |
Hi, @jennantilla! Thanks for investigating this. 🙂 Sorry to comment on a closed issue, but it’s still occurring in the latest release (5.0.4). Now that the issue is fixed in 5.1.1, can we update the dependency in this project to resolve the build issue here? I can confirm making this change locally in - api 'com.onesignal:OneSignal:5.0.5'
+ api 'com.onesignal:OneSignal:5.1.1' |
I can confirm still occurring in latest release! Just went to install today, and having this problem right now! @short-dsb |
@short-dsb we will be working on getting an update out for wrappers including React Native as soon as possible. @Lurtroxx are you still experiencing this on 5.1.1 of the native Android SDK? |
Yes both android and ios, the solution was to put this script given by @SohelIslamImran into the root and run it upon build.
|
I've faced this issue only on Android not ios. |
This worked for me @KodyKendall 🥳 thank you... |
What happened?
The android build fails with this error:
Duplicate class androidx.work.OneTimeWorkRequestKt found in modules work-runtime-2.8.0-runtime (androidx.work:work-runtime:2.8.0) and work-runtime-ktx-2.7.1-runtime (androidx.work:work-runtime-ktx:2.7.1)
Duplicate class androidx.work.PeriodicWorkRequestKt found in modules work-runtime-2.8.0-runtime (androidx.work:work-runtime:2.8.0) and work-runtime-ktx-2.7.1-runtime (androidx.work:work-runtime-ktx:2.7.1)
Go to the documentation to learn how to Fix dependency resolution errors.
Steps to reproduce?
What did you expect to happen?
I expected a successful build
React Native OneSignal SDK version
Release 5.0.0
Which platform(s) are affected?
Relevant log output
Code of Conduct
The text was updated successfully, but these errors were encountered: