Eventbus: Unable to start activity - Subscriber classes and its super classes have no public methods with the @Subscribe notation

Created on 10 Mar 2016  Â·  9Comments  Â·  Source: greenrobot/EventBus

I'm developing an Android application using EventBus to asynchronously post objects to other classes. However, while running the application, EventBusException says the following:

Subscriber class meetup.be2015.gcm_meetup.MapClass and its super classes have no public methods with the @Subscribe annotation

03-10 14:05:27.000 6490-6490/meetup.be2015.gcm_meetup E/AndroidRuntime: FATAL EXCEPTION: main
    java.lang.RuntimeException: Unable to start activity ComponentInfo{meetup.be2015.gcm_meetup/meetup.be2015.gcm_meetup.MapClass}: org.greenrobot.eventbus.EventBusException: Subscriber class meetup.be2015.gcm_meetup.MapClass and its super classes have no public methods with the @Subscribe annotation
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2118)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2143)
        at android.app.ActivityThread.access$700(ActivityThread.java:140)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:174)
        at android.app.ActivityThread.main(ActivityThread.java:4952)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:511)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
        at dalvik.system.NativeStart.main(Native Method)
     Caused by: org.greenrobot.eventbus.EventBusException: Subscriber class meetup.be2015.gcm_meetup.MapClass 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 meetup.be2015.gcm_meetup.MapClass.onStart(MapClass.java:90)
        at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1178)
        at android.app.Activity.performStart(Activity.java:5198)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2091)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2143) 
        at android.app.ActivityThread.access$700(ActivityThread.java:140) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237) 
        at android.os.Handler.dispatchMessage(Handler.java:99) 
        at android.os.Looper.loop(Looper.java:174) 
        at android.app.ActivityThread.main(ActivityThread.java:4952) 
        at java.lang.reflect.Method.invokeNative(Native Method) 
        at java.lang.reflect.Method.invoke(Method.java:511) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794) 
        at dalvik.system.NativeStart.main(Native Method) 

I have posted the two activities on StackOverflow. You can find them here.

Can someone help me? I'm stuck for a long time, and I can't seem to find a workaround at all!

support / not an issue

Most helpful comment

@Subscribe
public void onEventMainThread(UploadOrderEvent event) {
}

Check you methods is't private? Just change it be public.

All 9 comments

I answered it on stackoverflow, hope it helps :)

@Subscribe
public void onEventMainThread(UploadOrderEvent event) {
}

Check you methods is't private? Just change it be public.

@elsennov No it doesn't help because you didnt link your stackoverflow answer here

@wingoku he didn't need to because the previous poser had already added the link.
Here it is again http://stackoverflow.com/a/35912503/493682

Closing as solved on Stackoverflow. -ut

I am getting this error even after making onEvent() method public. And I am running this in debug mode.

This bug can be reopened, since all @Subscribe methods gets deleted by using R8, no matter of proguard rules. All subscribe methods are public.

shrinkResources true
            minifyEnabled true

I am facing the same issue after
minifyEnabled true
no matter what the pro guard rules

you didn't set the path to proguard rules in gradle file

On Mon, Apr 27, 2020 at 12:19 PM aqsaShahid-zameen notifications@github.com
wrote:

I am facing the same issue after
minifyEnabled true
no matter what the pro guard rules

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/greenrobot/EventBus/issues/271#issuecomment-619849928,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AA473QRMBGXU2EMLN2ETNN3ROVE27ANCNFSM4B5WC3XA
.

Was this page helpful?
0 / 5 - 0 ratings