【发布时间】:2019-05-29 20:12:40
【问题描述】:
我正在使用 GreenRobot EventBus ,我想根据文档定义一些 Threading 属性,
但是,当我写的时候:
@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'
【问题讨论】:
-
您介意在您的问题中添加确切的错误消息吗?
-
@fangzhzh,我添加了错误信息;抱歉,我认为编译器无法识别它是直观的。
-
我怀疑您的项目使用了另一个库,该库也有一个 @subscribe 关键字。当光标在“@Subscriber”并转到定义时,您可以尝试 CMD+B,它会转到 org.greenrobot.eventbu.Subscribe 吗?
-
@fangzhzh 哇,你是对的,不知何故它正在使用 com.google.common.eventbus 代替
标签: android annotations event-bus greenrobot-eventbus greenrobot-eventbus-3.0