jw
01/17/2017, 11:51 PM.buffer(2, 1).map(..)
jw
01/17/2017, 11:52 PMwindow(2, 1)
jw
01/17/2017, 11:52 PMzak.taccardi
01/17/2017, 11:56 PMdimsuz
01/18/2017, 1:28 PMjava.lang.NoClassDefFoundError: Could not initialize class io.reactivex.android.schedulers.AndroidSchedulers
dimsuz
01/18/2017, 1:28 PMdimsuz
01/18/2017, 1:29 PMdimsuz
01/18/2017, 1:30 PMalex.hart
01/18/2017, 2:06 PMdimsuz
01/18/2017, 2:13 PMalex.hart
01/18/2017, 2:15 PMalex.hart
01/18/2017, 2:17 PMdimsuz
01/18/2017, 2:18 PMalex.hart
01/18/2017, 2:23 PMnitrog42
01/18/2017, 2:55 PMnitrog42
01/18/2017, 2:58 PMdimsuz
01/18/2017, 3:24 PMI have ported a rather big app to RxJava2, it compiles and runs, but my unit tests which depend on rx all are failing with this error: java.lang.NoClassDefFoundError: Could not initialize class io.reactivex.android.schedulers.AndroidSchedulersI kinda figured this out, but still don't know what happens. So if I call this in
@BeforeClass
in my unit tests:
fun injectTestingRxSchedulers() {
RxJavaPlugins.reset()
RxJavaPlugins.setInitComputationSchedulerHandler { Schedulers.trampoline() }
RxJavaPlugins.setComputationSchedulerHandler { Schedulers.trampoline() }
RxAndroidPlugins.reset()
RxAndroidPlugins.setInitMainThreadSchedulerHandler { Schedulers.trampoline() }
RxAndroidPlugins.setMainThreadSchedulerHandler { Schedulers.trampoline() }
}
I receive a class def not found errors and also exception-in-initializer errors.
But if I strip it down to only
fun injectTestingRxSchedulers() {
// RxJavaPlugins.reset()
// RxJavaPlugins.setInitComputationSchedulerHandler { Schedulers.trampoline() }
// RxJavaPlugins.setComputationSchedulerHandler { Schedulers.trampoline() }
RxAndroidPlugins.reset()
RxAndroidPlugins.setInitMainThreadSchedulerHandler { Schedulers.trampoline() }
RxAndroidPlugins.setMainThreadSchedulerHandler { Schedulers.trampoline() }
}
then no exceptions are thrown! So this is not a class path error. But some tricky hook-related one, I don't know them that well...alex.hart
01/18/2017, 3:33 PMadambl4
01/18/2017, 3:34 PM@BeforeClass
?dimsuz
01/18/2017, 4:10 PMWhat happens when you run with that commented out block below RxAndroidPlugins fns? does initialization order matter somehow?Perhaps it's related, but it doesn't help, still same errors... 🙂 I've heard that hooks are tricky, I guess I should inject schedulers instead, but the codebase is rather large, need some "quick" solution for now...
dimsuz
01/18/2017, 4:10 PMare you able to get any other class in @BeforeClass?yes, seems like there's no problem with that
zak.taccardi
01/18/2017, 4:12 PMfun <T, R> Observable<T>.scanMap(func2: (T?, T) -> R): Observable<R> {
return this.startWith(null as T?)
.buffer(2, 1)
.map { func2.invoke(it[0], it[1]) }
}
https://gist.github.com/ZakTaccardi/06512860c37c732da165f6b4c2be40a5mingkangpan
01/18/2017, 5:47 PMFATAL EXCEPTION: RxCachedThreadScheduler-1 java.io.InterruptedIOException: thread interrupted
if I dispose a pending okhttp3 call in an observable?
but why does the app crash? should not observable catch the error and delegate it to onError?!
I dont understand this..... 😞mingkangpan
01/18/2017, 5:48 PMbob
01/18/2017, 9:28 PMonError
?zak.taccardi
01/19/2017, 12:15 AMonError
handler in your .subscribe()
thomasnield
01/19/2017, 8:21 PMautoConnect()
cause memory leaks due to persistent subscription to source when no more downstream subscribers are present? Especially with replay()
?thomasnield
01/19/2017, 8:33 PMcache()
as well?thomasnield
01/19/2017, 8:34 PMralf
01/19/2017, 8:41 PM