0

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'
htafoya
  • 18,261
  • 11
  • 80
  • 104
  • Do you mind adding the exact error message to your question? – fangzhzh May 29 '19 at 20:23
  • @fangzhzh, i added the error message; sorry I thought it was intuitive by saying that compiler didn't recognize it. – htafoya May 29 '19 at 22:00
  • 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? – fangzhzh May 29 '19 at 22:39
  • @fangzhzh wow you are right, somehow it is using the com.google.common.eventbus instead – htafoya May 29 '19 at 23:46

1 Answers1

2

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

fangzhzh
  • 2,172
  • 21
  • 25