我正在使用RxBus这是一个Otto / EventBus的RxJava克隆,用于在我的Android应用程序的不同组件之间进行通信。该应用程序在我的摩托罗拉Moto x 2013运行ICS上运行良好,没有崩溃。但是在运行Android M的Nexus 5X上,它会抛出这个异常:
Fatal Exception: java.lang.IllegalStateException: Exception thrown on Scheduler.Worker thread. Add `onError` handling.
at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:60)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5333)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645)
at dalvik.system.NativeStart.main(NativeStart.java)
Caused by rx.exceptions.OnErrorNotImplementedException: [EventProducer public xyz.chanl.radio.events.Events$StageProgram xyz.chanl.radio.fragments.ProgramListFragment.stageProgram()] has been invalidated and can no longer produce events.
at rx.Observable$27.onError(Observable.java:8139)
at rx.observers.SafeSubscriber._onError(SafeSubscriber.java:157)
at rx.observers.SafeSubscriber.onError(SafeSubscriber.java:120)
at rx.internal.operators.OperatorSubscribeOn$1$1.onError(OperatorSubscribeOn.java:59)
at rx.Observable.unsafeSubscribe(Observable.java:8321)
at rx.internal.operators.OperatorSubscribeOn$1.call(OperatorSubscribeOn.java:94)
at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5333)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645)
at dalvik.system.NativeStart.main(NativeStart.java)
Caused by java.lang.IllegalStateException: [EventProducer public xyz.chanl.radio.events.Events$StageProgram xyz.chanl.radio.fragments.ProgramListFragment.stageProgram()] has been invalidated and can no longer produce events.
at com.hwangjr.rxbus.entity.ProducerEvent.produceEvent(ProducerEvent.java:98)
at com.hwangjr.rxbus.entity.ProducerEvent.access$000(ProducerEvent.java:17)
at com.hwangjr.rxbus.entity.ProducerEvent$1.call(ProducerEvent.java:80)
at com.hwangjr.rxbus.entity.ProducerEvent$1.call(ProducerEvent.java:76)
at rx.Observable.unsafeSubscribe(Observable.java:8314)
at rx.internal.operators.OperatorSubscribeOn$1.call(OperatorSubscribeOn.java:94)
at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5333)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645)
at dalvik.system.NativeStart.main(NativeStart.java)
我用Google搜索了,但之前似乎没有人遇到过这个问题,或者我找不到类似的堆栈跟踪。
我该如何调查此问题?
I register
和unregister
总线位于片段的onStart
和onStop
函数中。
答案 0 :(得分:0)
所以,我调查过,并且我意识到这通常发生在您注册多个发布相同事件的生产者时。因此,当生产者在特定事件中注册时,它会使第二个事件无效。我不知道这个设计是否是故意的。