-
Notifications
You must be signed in to change notification settings - Fork 3k
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
RxJava 3 support #538
Comments
Because RxJava 3 exists in a different groupId but the same package name you need to tell your build system to replace all dependencies on 2.x with your desired 3.x version. If your build system is Gradle you can read about dependency substitution here: https://docs.gradle.org/current/userguide/customizing_dependency_resolution_behavior.html#sec:dependency_substitution_rules Beyond this, you'll want to ask for help on the RxJava project directly or on StackOverflow since there's nothing specific to RxAndroid about the question aside from its 2.x dependency (which is no different than any other library). |
That is correct , you just need exclude external implementation ('io.reactivex.rxjava2:rxandroid:2.1.0') {
exclude group: 'io.reactivex.rxjava2', module: 'rxjava'
} |
It'd be far better long-term to craft a substitution rule than playing whack-a-mole with excludes. |
Yes, I'm not in the right way, thank you for your guidance. 👏 I read the documentation and configured it as follows,is that alright? 😄 configurations {
compile.exclude group: 'io.reactivex.rxjava2', module: 'rxjava'
all {
resolutionStrategy {
eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'io.reactivex.rxjava3' &&
details.requested.name == 'rxjava') {
details.useVersion '3.0.0-RC0'
details.because 'Unified the version of RxJava3.'
}
}
}
}
}
dependencies {
// ...
implementation rootProject.ext.dependencies['rxjava3']
implementation rootProject.ext.dependencies['rxandroid']
} The code above is not in correct way, please refer to the reply below. ⬇️ |
Will rxAndroid be updated to 3.x with rxJava together? |
I guess so. Seems like we don't have much of a choice. Thankfully this
library is finished and requires no real changes!
…On Mon, Jul 22, 2019 at 4:53 AM aquarids ***@***.***> wrote:
Will rxAndroid be updated to 3.x with rxJava together?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#538?email_source=notifications&email_token=AAAQIEPZAXX26FFGFZ3K4W3QAVYRTA5CNFSM4H44DBG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2PHYTA#issuecomment-513702988>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAQIELG4E5XJHTESXTTQH3QAVYRTANCNFSM4H44DBGQ>
.
|
Reopening for tracking. I would also not use |
like this?
|
Yes. This snippet is going to be copy/pasta'd around for quite some time: resolutionStrategy.dependencySubstitution {
substitute module('io.reactivex.rxjava2:rxjava') with module('io.reactivex.rxjava3:rxjava:3.0.0-RC1')
} |
Please see also ReactiveX/RxJava#6606 which is a discussion around the two problems with migration and compatibility of RxJava 3:
Regardless of what happens with 1, if you're supportive of fixing 2 like I am (by retaining the groupId of 2.x and thus allowing build systems to treat them as providing the same APIs in the sam package) vote/weigh in on that issue. |
I found a very strange case (I am not very familiar with the if I just add mylibrary -> build.gradleconfigurations.all {
resolutionStrategy.dependencySubstitution {
substitute module('io.reactivex.rxjava2:rxjava') with module('io.reactivex.rxjava3:rxjava:3.0.0-RC1')
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
api 'io.reactivex.rxjava3:rxjava:3.0.0-RC1'
api 'io.reactivex.rxjava2:rxandroid:2.1.0'
} app -> build.gradle(no resolutionStrategy.dependencySubstitution)
when I tried to build and run app, I got an error:
I thought this way could not fulfill my needs, so I config mylibrary -> configurations {
// use exclude
compile.exclude group: 'io.reactivex.rxjava2', module: 'rxjava'
all {
resolutionStrategy {
eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'io.reactivex.rxjava3' &&
details.requested.name == 'rxjava') {
details.useVersion '3.0.0-RC0'
details.because 'Unified the version of RxJava3.'
}
}
}
}
} Subsequent attemptsWhen I saw the solution code of Jake, I found that I took an indirect route, finally I tried it in my app -> configurations.all {
resolutionStrategy.dependencySubstitution {
substitute module('io.reactivex.rxjava2:rxjava') with module('io.reactivex.rxjava3:rxjava:3.0.0-RC1')
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(path: ':mylibrary')
} and remove //configurations.all {
// resolutionStrategy.dependencySubstitution {
// substitute module('io.reactivex.rxjava2:rxjava') with module('io.reactivex.rxjava3:rxjava:3.0.0-RC1')
// }
//}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
api 'io.reactivex.rxjava3:rxjava:3.0.0-RC1'
api 'io.reactivex.rxjava2:rxandroid:2.1.0'
// ...
} Moving the |
Now that RxJava 3.0.0-RC2 has moved everything to a new package, the dependency substitution workaround mentioned above no longer applies, and currently RxJavaBridge needs to be used to use RxAndroid with with RxJava 3. Can I offer a PR upgrading RxAndroid to RxJava 3 so an alpha/RC/whatever can be released? |
Landed on 3.x branch... I'll figure out Travis |
How to use this with RxJava 3??
I'm getting duplicate files error on build.
Thank you.
The text was updated successfully, but these errors were encountered: