EventBus icon indicating copy to clipboard operation
EventBus copied to clipboard

java.lang.annotation.IncompleteAnnotationException org.greenrobot.eventbus.n missing element priority

Open vidhipatel94 opened this issue 5 years ago • 3 comments

I am getting this crash on Samsung android version 8:

Caused by java.lang.annotation.IncompleteAnnotationException: org.greenrobot.eventbus.n missing element priority
       at libcore.reflect.AnnotationFactory.invoke + 301(AnnotationFactory.java:301)
       at java.lang.reflect.Proxy.invoke + 913(Proxy.java:913)
       at $Proxy4.priority($Proxy4.java)
       at org.greenrobot.eventbus.SubscriberMethodFinder.findUsingReflectionInSingleClass + 171(SubscriberMethodFinder.java:171)
       at org.greenrobot.eventbus.SubscriberMethodFinder.findUsingInfo + 88(SubscriberMethodFinder.java:88)
       at org.greenrobot.eventbus.SubscriberMethodFinder.findSubscriberMethods + 64(SubscriberMethodFinder.java:64)
       at org.greenrobot.eventbus.EventBus.register + 140(EventBus.java:140)
       at com.companyname.myapp.ui.home.MainActivity.onCreate + 141(MainActivity.java:141)
       at android.app.Activity.performCreate + 7258(Activity.java:7258)
       at android.app.Activity.performCreate + 7249(Activity.java:7249)
       at android.app.Instrumentation.callActivityOnCreate + 1222(Instrumentation.java:1222)
       at android.app.ActivityThread.performLaunchActivity + 2941(ActivityThread.java:2941)
       at android.app.ActivityThread.handleLaunchActivity + 3073(ActivityThread.java:3073)
       at android.app.ActivityThread.-wrap11(ActivityThread.java)
       at android.app.ActivityThread$H.handleMessage + 1734(ActivityThread.java:1734)
       at android.os.Handler.dispatchMessage + 106(Handler.java:106)
       at android.os.Looper.loop + 164(Looper.java:164)
       at android.app.ActivityThread.main + 7025(ActivityThread.java:7025)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run + 441(RuntimeInit.java:441)
       at com.android.internal.os.ZygoteInit.main + 1408(ZygoteInit.java:1408)

I am registering event bus in oncreate method: EventBus.getDefault().register(this);

I am subscribing more than 1 events in MainActivity like:

@Subscribe(threadMode = ThreadMode.MAIN)
    public void onMessageUpdatingEvent(MessageUpdatingEvent event) {
       //code
    }

@Subscribe(threadMode = ThreadMode.MAIN)
    public void onMessageUpdatedEvent(MessageUpdatedEvent event) {
        //code
    }

vidhipatel94 avatar Jul 23 '19 16:07 vidhipatel94

Check that you do not have multiple versions of EventBus added to your project. The priority property of @Subscribe was added with EventBus 3.0.0, make sure all of your code and libraries use the same version to compile.

greenrobot-team avatar Aug 06 '19 11:08 greenrobot-team

Got the same error, how to solve it?

Not have multiple versions of EventBus added to my project, only version 3.1.1.

#原来是第三方jar库引起,也不是EventBus版本冲突,具体原因未知(似乎跟jar编译的jdk版本有关),待查。

eagle518 avatar Jun 19 '20 09:06 eagle518

maybe ur third part lib also have the annotation called @Subscribe and eventbus get the wrong annotation which don't have the priority value

tomridder avatar Mar 16 '23 07:03 tomridder