https://kotlinlang.org logo
#android
Title
# android
v

Viktor Vostrikov

02/02/2019, 8:32 PM
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

ghedeon

02/02/2019, 8:44 PM
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

Viktor Vostrikov

02/02/2019, 8:53 PM
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

ghedeon

02/02/2019, 9:45 PM
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

rkeazor

02/03/2019, 3:02 AM
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

Icaro Temponi

02/03/2019, 5:53 PM
I'm just waiting channels leave experimental state and cold streams come to start using them instead of Rx
g

gildor

02/04/2019, 5:11 AM
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

Paul Woitaschek

02/04/2019, 8:30 AM
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

gildor

02/04/2019, 9:09 AM
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