priyankvex
priyankvex

Reputation: 6050

How to specify the version of RxJava when using RxKotlin?

Docs in the RxKotlin repository on GitHub doesn't specify a way to explicitly depend on the latest RxJava versionn.

If we see the build.gradle file of the library, it as of now uses compile 'io.reactivex.rxjava2:rxjava:2.1.0'

But what if we want to keep up with the latest RxJava releases and not the one present in the library.

Upvotes: 0

Views: 907

Answers (2)

guenhter
guenhter

Reputation: 12177

If you define the rxjava version in your build.gradle, gradle will take the latest one defined (yours or the one of the library, depending which is the latest version).

So you can

dependencies {
    compile 'io.reactivex.rxjava2:rxjava:2.1.1'
}

or if you always want to have the most recent version

dependencies {
    compile 'io.reactivex.rxjava2:rxjava:+'
}

But be aware of problems in the rxkotlin library if the version are not longer compatible (e.g. you stay on rxkotlin:2.x and rxjava 3.x. So it is a good way to update rxkotlin as well if possible.

Upvotes: 0

priyankvex
priyankvex

Reputation: 6050

You can override the version of RxJava in your projects build.gradle.

The specified version of RxJava will be chosen (and override RxKotlin's) if you just explicitly specify it like this in Gradle/Maven:

dependencies {
    compile 'io.reactivex.rxjava2:rxjava:2.1.1'
    compile 'io.reactivex.rxjava2:rxkotlin:2.1.0'
}

This is also stated in the RxAndroid readme file. I had a little chat with one of the contributors of the RxKotlin and he said that just like RxAndroid, they also internally use the same policy.

Upvotes: 1

Related Questions