我正在使用GreenRobot EventBus,我想定义一些线程属性,根据文档,
但是,当我写:
@Subscribe(threadMode = ThreadMode.MAIN)
public void onShowNotification(NotificationEvent event) {
if(event == NotificationEvent.bannerEvent) {
updateContents();
}
}
我收到一个错误,编译器指定方法无法识别线程模式:cannot resolve method 'threadMode'
我的gradle
文件上有:
implementation 'org.greenrobot:eventbus:3.1.1'
我怀疑您的项目使用了另一个也具有@Subscribe
关键字的库。当光标在@Subscriber
中并转到定义时,您可以尝试CMD + B吗,它会转到org.greenrobot.eventbu.Subscribe
吗?
这里的要点是:当错误cannot resolve method
发生时,您可以随时转到定义以检查那里发生了什么:)