简体   繁体   中英

EventBus - threadMode not regonized as @Subscribe annotation property :cannot resolve method threadMode

I am using GreenRobot EventBus , I wanted to define some Threading properties, according to docs,

However, when I write:

 @Subscribe(threadMode = ThreadMode.MAIN)
    public void onShowNotification(NotificationEvent event) {
        if(event == NotificationEvent.bannerEvent) {
            updateContents();
        }
    }

I get an error that threadMode is not recognized by compiler specifying method: cannot resolve method 'threadMode'

i have on my gradle file:

implementation 'org.greenrobot:eventbus:3.1.1'

I suspect that your project uses another library which also has a @Subscribe keyword. Can you try CMD+B when the cursor in the @Subscriber and go to the definition, does it go to org.greenrobot.eventbu.Subscribe ?

The takeaway here : when error cannot resolve method happens, you can always go to the definition to check what happens there :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM