EventBusException: Subscriber class *** and its super classes have no public methods with the @Subsc
2016-10-18 23:43
615 查看
简述:
去年的时候使用过一次EventBus,今天又遇到使用EventBus的项目,由于时隔一年多了所以写了一个Demo,但不行的是按照往常的用法却报出了这个异常:
EventBusException: Subscriber class *** and its super classes have no public methods with the @Subscribe annotation。说明一下,我用的是3.0.0版本的EventBus。
异常日志:
ava.lang.RuntimeException: Unable to start activity ComponentInfo{com.lizhenya.eventbusdemo/com.lizhenya.eventbusdemo.MainActivity}: org.greenrobot.eventbus.EventBusException: Subscriber class com.lizhenya.eventbusdemo.MainActivity and its super classes have no public methods with the @Subscribe annotation
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: org.greenrobot.eventbus.EventBusException: Subscriber class com.lizhenya.eventbusdemo.MainActivity 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.lizhenya.eventbusdemo.MainActivity.onCreate(MainActivity.java:24)
at android.app.Activity.performCreate(Activity.java:6237)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
解决方案:
在onEventMainThread()方法上加注解“@Subscribe”;
解决方案:
在onEventMainThread()方法上加注解“@Subscribe”;
去年的时候使用过一次EventBus,今天又遇到使用EventBus的项目,由于时隔一年多了所以写了一个Demo,但不行的是按照往常的用法却报出了这个异常:
EventBusException: Subscriber class *** and its super classes have no public methods with the @Subscribe annotation。说明一下,我用的是3.0.0版本的EventBus。
异常日志:
ava.lang.RuntimeException: Unable to start activity ComponentInfo{com.lizhenya.eventbusdemo/com.lizhenya.eventbusdemo.MainActivity}: org.greenrobot.eventbus.EventBusException: Subscriber class com.lizhenya.eventbusdemo.MainActivity and its super classes have no public methods with the @Subscribe annotation
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: org.greenrobot.eventbus.EventBusException: Subscriber class com.lizhenya.eventbusdemo.MainActivity 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.lizhenya.eventbusdemo.MainActivity.onCreate(MainActivity.java:24)
at android.app.Activity.performCreate(Activity.java:6237)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
解决方案:
在onEventMainThread()方法上加注解“@Subscribe”;
Android学习交流群:523487222
(如果您觉得有用,欢迎加入,一起学习进步)
点击链接加入群【Android学习群】
解决方案:
在onEventMainThread()方法上加注解“@Subscribe”;
相关文章推荐
- EventBusException: Subscriber class *** and its super classes have no public methods with the @Subsc
- EventBusException: Subscriber class *** and its super classes have no public methods with the @Subsc
- Subscriber class xxx.xxx.xxx and its super classes have no public methods with the@Subscribe annotat
- Subscriber class xxx.xxx.xxx and its super classes have no public methods with the@Subscribe annotat
- 异常 EventBusException:its super classes have no public methods with the @Subscribe annotation
- 异常 EventBusException:its super classes have no public methods with the @Subscribe annotation
- MainActivity and its super classes have no public methods with the @Subscribe annotation
- Subscriber class .NewsFragment and its super classes have no public methods
- EventBus报错:and its super classes have no public methods with the @Subscribe annotation
- [置顶] 【Android】AndroidStudio关于EventBus报错解决方法its super classes have no public methods with the @Subscribe
- Eventbus注册异常:its super classes have no public methods with the @Subscribe annotation
- 使用EventBus,debug不报错,release版本报错:its super classes have no public methods with the @Subscribe annotat
- 使用EventBus框架报异常:its super classes have no public methods with the @Subscribe annotation
- 【Android】AndroidStudio关于EventBus报错解决方法its super classes have no public methods with the @Subscr...
- Caused by: de.greenrobot.event.EventBusException: Subscriber class has no public methods called on
- EventBus3.0报错..its super classes have no public methods with the @Subscribe annotation
- AndroidStudio关于EventBus报错解决方法its super classes have no public methods with the @Subscribe
- EventBus 注册错误no public methods with the @Subscribe annotation
- Javascript Module pattern template. Shows a class with a constructor and public/private methods/properties. Also shows compatibility with CommonJS(eg Node.JS) and AMD (eg requireJS) as well as in a br
- An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means