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

719 Views Asked by At

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'
1

There are 1 best solutions below

0
fangzhzh On BEST ANSWER

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 :)