Since Kotlin is 100% interoperable with Java, you can use most Java libraries in your Kotlin projects without any difficulties—and the RxJava library is no exception.
There is a dedicated RxKotlin library, which is a Kotlin wrapper around the regular RxJava library. This wrapper provides extensions that optimize RxJava for the Kotlin environment and can further reduce the amount of boilerplate code you need to write.
If you are using rxkotlin
you just need to add the following line
implementation 'io.reactivex:rxkotlin:x.y.z'
and if you want to use rxjava2
you need to include the other dependencies i.e
implementation 'io.reactivex.rxjava2:rxjava:2.2.4'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
but if you are using Kotlin as your programming language I will recommend you using rxkotlin
More detail refer to this link