04-14 17:13:58.199 13449-13449/com.im E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.im, PID: 13449
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.im/com.im.activity.LoginActivity}: org.greenrobot.eventbus.EventBusException: Subscriber class com.im.activity.LoginActivity and its super classes have no public methods with the @Subscribe annotation
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3303)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3411)
at android.app.ActivityThread.-wrap12(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1994)
at android.os.Handler.dispatchMessage(Handler.java:108)
at android.os.Looper.loop(Looper.java:166)
at android.app.ActivityThread.main(ActivityThread.java:7529)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
Caused by: org.greenrobot.eventbus.EventBusException: Subscriber class com.im.activity.LoginActivity and its super classes have no public methods with the @Subscribe annotation
at org.greenrobot.eventbus.SubscriberMethodFinder.findSubscriberMethods(SubscriberMethodFinder.java:67)
at org.greenrobot.eventbus.EventBus.register(EventBus.java:136)
at com.im.activity.LoginActivity.onCreate(LoginActivity.java:125)
at android.app.Activity.performCreate(Activity.java:7383)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1218)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3256)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3411)
at android.app.ActivityThread.-wrap12(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1994)
at android.os.Handler.dispatchMessage(Handler.java:108)
at android.os.Looper.loop(Looper.java:166)
at android.app.ActivityThread.main(ActivityThread.java:7529)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
04-14 17:13:58.208 13449-13449/com.im I/Process: Sending signal. PID: 13449 SIG: 9
EventBus.getDefault().register(this); 注册
一定要写取消注册
EventBus.getDefault().unregister(this);
注册后,当前类中一定要有处理方法,不然会报错
@Subscribe(threadMode = ThreadMode.MAIN)
public void XXX(String messageEvent) {
}
https://www.jianshu.com/p/49c2a6a149e0
https://blog.csdn.net/zzb_bin/article/details/80229456
https://blog.csdn.net/u014733374/article/details/72625700
https://blog.csdn.net/u012317510/article/details/78935720