Hello, should I be replacing RxJava for coroutines...
# android
v
Hello, should I be replacing RxJava for coroutines? I need to decrease size of the library, because RxJava takes a lot of space in the Android project... I have written a detailed question in Android Reddit subreddit ( really great community there) https://www.reddit.com/r/androiddev/comments/amfy3f/should_i_switch_rxjava_for_kotlin_coroutines/?utm_source=reddit-android
g
If all you use is
Single/Maybe/Completable
than yes. If you deal with something actually reactive, then it's probably too early, I'd wait for the cold streams.
👍 2
v
I do use observables and zip operator. However, i could change that to MediatorLiveData, it would work on main Thread, but operation are simple, so it won't create problems for UI thread
g
Depends on your usage of rx, the next day you replace it with LiveData you might find yourself re-implementing Rx operators from scratch. I'm not trying to be edgy here, but LiveData is absolute bullcrap outside of the view. Trust me, because I've wasted 3 months trying to survive on LiveData only (like they show in their toy examples), I've burned myself badly and now I'm back to Rx. And my skin and hair are smooth and silky again.
😀 6
r
Coroutines and Rx Java are two completely different things. They both have there own separate use case.
So if your issue is lib size, than you should weigh the pros and cons and see if it's worth it in your particular cas
i
I'm just waiting channels leave experimental state and cold streams come to start using them instead of Rx
g
decrease size of the library, because RxJava takes a lot of space in the Android project
@Viktor Vostrikov I would rather configured Proguard/R8, it would be much more efficient rather than switch core library just to decrease method count on a few thousands methods
p
Analyze your apk, the gain from replacing one library with another should be neglible if you're using proguard. Most of the time optimizing resources let you decrease your apk way more.
g
Depends on what is "a lot of space", if apk size, firts thing what should be done is migrate to app bundle and than review resources