element-hq / element-android

A Matrix collaboration client for Android.
https://element.io/
GNU Affero General Public License v3.0
3.34k stars 711 forks source link

Replace RxJava 2 usages #4087

Closed erikhuizinga closed 2 years ago

erikhuizinga commented 3 years ago

Your use case

What would you like to do?

Replace all dependencies on RxJava 2.

Why would you like to do it?

RxJava 2 has been deprecated since RxJava 3 was available, and has been end-of-life since early 2021: https://github.com/ReactiveX/RxJava/tree/v3.1.1#version-2x. This means that it no longer receives updates, i.e. features and bug fixes. This is a risk that is difficult to quantify, but it will certainly grow as time progresses.

How would you like to achieve it?

Replace all existing dependencies on RxJava 2 with either RxJava 3 (migrate) or alternatives (e.g. Kotlin's observable/flow constructs provided by the standard library and the coroutines library, which are already dependencies in this project).

Some useful resources:

Configuration on demand is an incubating feature.

> Configure project :vector
WARNING:API 'ApkVariantOutput.getVersionCodeOverride()' is obsolete and has been replaced with 'VariantOutput.versionCode()'.
It will be removed in version 7.0 of the Android Gradle plugin.
Gradle Properties must be used to change Variant information.
For more information, see https://d.android.com/r/tools/use-properties.
To determine what is calling ApkVariantOutput.getVersionCodeOverride(), use -Pandroid.debug.obsoleteApi=true on the command line to display more information.
ABI arm64-v8a   -> VersionCode = 40103002
ABI armeabi-v7a     -> VersionCode = 40103001
ABI null    -> VersionCode = 40103000
ABI x86     -> VersionCode = 40103003
ABI x86_64  -> VersionCode = 40103004
ABI arm64-v8a   -> VersionCode = 40103002
ABI armeabi-v7a     -> VersionCode = 40103001
ABI null    -> VersionCode = 40103000
ABI x86     -> VersionCode = 40103003
ABI x86_64  -> VersionCode = 40103004
ABI arm64-v8a   -> VersionCode = 40103002
ABI armeabi-v7a     -> VersionCode = 40103001
ABI null    -> VersionCode = 40103000
ABI x86     -> VersionCode = 40103003
ABI x86_64  -> VersionCode = 40103004
ABI arm64-v8a   -> VersionCode = 40103002
ABI armeabi-v7a     -> VersionCode = 40103001
ABI null    -> VersionCode = 40103000
ABI x86     -> VersionCode = 40103003
ABI x86_64  -> VersionCode = 40103004

> Task :vector:dependencyInsight
io.reactivex.rxjava2:rxandroid:2.1.1
   variant "compile" [
      org.gradle.status                              = release (not requested)
      org.gradle.usage                               = java-api
      org.gradle.libraryelements                     = jar (not requested)
      org.gradle.category                            = library (not requested)

      Requested attributes not found in the selected variant:
         com.android.build.api.attributes.BuildTypeAttr = debug
         store                                          = gplay
         org.gradle.jvm.environment                     = android
         org.jetbrains.kotlin.platform.type             = androidJvm
   ]
   Selection reasons:
      - By constraint : gplayDebugRuntimeClasspath uses version 2.1.1
      - By ancestor

io.reactivex.rxjava2:rxandroid:2.1.1
\--- gplayDebugCompileClasspath

io.reactivex.rxjava2:rxandroid:{strictly 2.1.1} -> 2.1.1
\--- gplayDebugCompileClasspath

io.reactivex.rxjava2:rxandroid:2.1.1
+--- com.airbnb.android:mvrx:1.5.1
|    \--- gplayDebugCompileClasspath
+--- com.jakewharton.rxbinding3:rxbinding:3.1.0
|    +--- gplayDebugCompileClasspath
|    +--- com.jakewharton.rxbinding3:rxbinding-material:3.1.0
|    |    \--- gplayDebugCompileClasspath
|    \--- com.jakewharton.rxbinding3:rxbinding-appcompat:3.1.0
|         \--- gplayDebugCompileClasspath
+--- com.jakewharton.rxbinding3:rxbinding-appcompat:3.1.0 (*)
+--- com.jakewharton.rxbinding3:rxbinding-material:3.1.0 (*)
\--- io.realm:realm-android-library:10.8.0
     +--- gplayDebugCompileClasspath (requested io.realm:realm-android-library:{strictly 10.8.0})
     \--- project :matrix-sdk-android
          \--- gplayDebugCompileClasspath

io.reactivex.rxjava2:rxjava:2.2.10
   variant "compile" [
      org.gradle.status                              = release (not requested)
      org.gradle.usage                               = java-api
      org.gradle.libraryelements                     = jar (not requested)
      org.gradle.category                            = library (not requested)

      Requested attributes not found in the selected variant:
         com.android.build.api.attributes.BuildTypeAttr = debug
         store                                          = gplay
         org.gradle.jvm.environment                     = android
         org.jetbrains.kotlin.platform.type             = androidJvm
   ]
   Selection reasons:
      - By constraint : gplayDebugRuntimeClasspath uses version 2.2.10
      - By ancestor

io.reactivex.rxjava2:rxjava:{strictly 2.2.10} -> 2.2.10
\--- gplayDebugCompileClasspath

io.reactivex.rxjava2:rxjava:2.2.10
+--- com.jakewharton.rxbinding3:rxbinding:3.1.0
|    +--- gplayDebugCompileClasspath
|    +--- com.jakewharton.rxbinding3:rxbinding-material:3.1.0
|    |    \--- gplayDebugCompileClasspath
|    \--- com.jakewharton.rxbinding3:rxbinding-appcompat:3.1.0
|         \--- gplayDebugCompileClasspath
\--- io.reactivex.rxjava2:rxkotlin:2.4.0
     \--- gplayDebugCompileClasspath

io.reactivex.rxjava2:rxjava:2.2.2 -> 2.2.10
\--- com.jakewharton.rxrelay2:rxrelay:2.1.1
     \--- gplayDebugCompileClasspath

io.reactivex.rxjava2:rxjava:2.2.6 -> 2.2.10
\--- io.reactivex.rxjava2:rxandroid:2.1.1
     +--- gplayDebugCompileClasspath
     +--- com.jakewharton.rxbinding3:rxbinding-material:3.1.0
     |    \--- gplayDebugCompileClasspath
     +--- com.jakewharton.rxbinding3:rxbinding-appcompat:3.1.0
     |    \--- gplayDebugCompileClasspath
     +--- com.jakewharton.rxbinding3:rxbinding:3.1.0
     |    +--- gplayDebugCompileClasspath
     |    +--- com.jakewharton.rxbinding3:rxbinding-material:3.1.0 (*)
     |    \--- com.jakewharton.rxbinding3:rxbinding-appcompat:3.1.0 (*)
     +--- io.realm:realm-android-library:10.8.0
     |    +--- gplayDebugCompileClasspath (requested io.realm:realm-android-library:{strictly 10.8.0})
     |    \--- project :matrix-sdk-android
     |         \--- gplayDebugCompileClasspath
     \--- com.airbnb.android:mvrx:1.5.1
          \--- gplayDebugCompileClasspath

io.reactivex.rxjava2:rxjava:2.2.9 -> 2.2.10
\--- com.airbnb.android:mvrx:1.5.1
     \--- gplayDebugCompileClasspath

io.reactivex.rxjava2:rxkotlin:2.4.0
   variant "compile" [
      org.gradle.status                              = release (not requested)
      org.gradle.usage                               = java-api
      org.gradle.libraryelements                     = jar (not requested)
      org.gradle.category                            = library (not requested)

      Requested attributes not found in the selected variant:
         com.android.build.api.attributes.BuildTypeAttr = debug
         store                                          = gplay
         org.gradle.jvm.environment                     = android
         org.jetbrains.kotlin.platform.type             = androidJvm
   ]
   Selection reasons:
      - By constraint : gplayDebugRuntimeClasspath uses version 2.4.0

io.reactivex.rxjava2:rxkotlin:2.4.0
\--- gplayDebugCompileClasspath

io.reactivex.rxjava2:rxkotlin:{strictly 2.4.0} -> 2.4.0
\--- gplayDebugCompileClasspath

(*) - dependencies omitted (listed previously)

A web-based, searchable dependency report is available by adding the --scan option.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.2/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 2s
1 actionable task: 1 executed

Have you considered any alternatives?

No response

Additional context

No response


tags for search: rx rxjava rxkotlin rxandroid reactive reactivex

ganfra commented 3 years ago

Thanks for the intel. We are planning to move away from Rx to use Kotlin coroutines Flow in the near future.

bmarty commented 2 years ago

Finalized in #4942