1. 程式人生 > >eventbus出錯記錄:Subscriber class and its super classes have no public methods with the @subscribe annot

eventbus出錯記錄:Subscriber class and its super classes have no public methods with the @subscribe annot

用過eventbus那麼也許遇到過這個錯誤:
Subscriber class and its super classes have no public methods with the @subscribe annotation
1.
一般就是沒在回撥方法onEvent加上@Subscribe

    @Subscribe
    public void onEvent(String message_Type) {
    }

2.
但我還遇到過另一種,如上我加了@Subscribe註釋,但任然報錯。

我是這麼寫的:

    @Subscribe
    protected
void onEvent(String message_Type) { }

最後我仔細看報錯資訊,發現了public關鍵字,報錯提示要求的是公共的方法
所以我把基類的回撥方法改成了這樣:

    @Subscribe
    public void onEvent(String message_Type) {
    }

最後就正常了。

希望可以幫助仍在尋找答案的朋友。

相關推薦

eventbus出錯記錄Subscriber class and its super classes have no public methods with the @subscribe annot

用過eventbus那麼也許遇到過這個錯誤: Subscriber class and its super classes have no public methods with the @subsc

EventBus3.0報錯..its super classes have no public methods with the @Subscribe annotation

EventBus也用了好久了,今天沒事想做個分享的demo,萬萬妹想到啊,剛整合就出了個問題 報錯如下 Caused by: org.greenrobot.eventbus.EventBusException: Subscriber class com

Subscriber class xxx.xxx.xxx and its super classes have no public methods with class="__cf_email__" data-cfemail

使用EventBus 3.0.0-beta1的出現bug 報錯的原因提示:提示我的onEventMainThread方法不是public 缺少@Subscribe這個註解。按照提示改為public 並且加上@Subscribe這個註解就Ok了。

解題記錄B - Red and Black

題目 There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a til

解題記錄B - FatMouse and Cheese

題目: FatMouse has stored some cheese in a city. The city can be considered as a square grid of dimension n: each grid location is labelled (p,q) wh

PHP 報錯Deprecated: Methods with the same name as their class will not be constructor...

5.6 name soa 項目 徹底 truct 升級 使用 The 報著個錯的原因是 最近把一個項目從php5.6升級到了php7 報如下錯誤: Deprecated: Methods with the same name as their class will not

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP

統一 apple col convert rstp stp line methods gree <?php class Car { var $color = "add"; function Car($color="green") {

Automation and AI in Retail: How are stores coping with the change?

Automation and AI in Retail: How are stores coping with the change?The retail shopping experience is constantly evolving. The stores of the future may look

EventBus 報“Subscriber class already registered to event class”錯誤

nbsp reat 方法 clas itl 容易 tle over register 這句子的話意思也很容易理解,“接收者類已經被註冊為事件類了”。 之前我是這麽寫: 事件註冊是寫在onStart()裏面的   @Override

CodeForces - 613DKingdom and its Cities(虛樹+DP)

for pro void 染色 however == force don tac Meanwhile, the kingdom of K is getting ready for the marriage of the King‘s daughter. However

java.lang.IllegalStateException: Context namespace element ‘annotation-config’ and its parser class

專案中用的是spring低版本(2.5.6),今天用jre 8測試了一下,發現錯誤: Unexpected exception parsing XML document from class path resource [applicationContext-dao.xml]; nested e

深度學習論文翻譯解析(二)An End-to-End Trainable Neural Network for Image-based Sequence Recognition and Its Application to Scene Text Recognition

論文標題:An End-to-End Trainable Neural Network for Image-based Sequence Recognition and Its Application to Scene Text Recognition 論文作者: Baoguang Shi, Xiang B

org.greenrobot.eventbus.EventBusException: Subscriber class com.nkbh.sevenday.mymodeldemo.MainActiv

在fragment中使用EvenBus時 EventBus.getDefault().register(getActivity()); 直接報錯: org.greenrobot.eventbus.EventBusException: Subscriber class com.nkbh.seve

【原創】問題定位分享(15)Context namespace element 'component-scan' and its parser class [org.springframework.context.annotation.ComponentScanBeanDefinit

今天嘗試執行一個古老的工程,配置好之後編譯通過,結果執行時報錯: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class p

錯誤記錄 linux 使用yum安裝軟體出錯 basn: /usr/bin/yum: /usr/bin/python: bad interpreter: no such file or

最近在使用yum安裝一些東西的時候出現錯誤:比如 yum -y install gcc 錯誤提示: basn: /usr/bin/yum: /usr/bin/python: bad interpreter: no such file or directory 通過網上查詢發現這是由

論文筆記An End-to-End Trainable Neural Network for Image-based Sequence Recognition and Its Application

1.歷史方法 1)基於字元的DCNN,比如photoOCR.單個字元的檢測與識別。要求單個字元的檢測器效能很強,crop的足夠好。 2)直接對圖片進行分類。9萬個單詞,組合成無數的單詞,無法直接應用 3)RNN,訓練和測試均不需要每個字元的位置。但是需要預處理,從圖片得到特

安裝Eric6提示Sorry, please install QScintilla2 and its PyQt5/PyQt4 wrapper.

  E:\python_installsoftware\eric6-18.11\eric6-18.11>python install.py install Checking dependencies Python Version: 3.7.1 Found PyQt5 Foun

spring2.5.6的‘annotation-config’ and its parser class are only available on JDK 1.5 and higher錯誤解決

最近在學習馬士兵的spring教程,視訊教程中的專案中用的是spring低版本(2.5.6),今天用jre 8測試了一下,發現錯誤:  Unexpected exception parsing XML document from class path resource

git pull出錯fatalPlease make sure you have the correct access rights.and the repository exists.

初學liunx,真是坑爹很多了,每天的錯誤。。。 Warning: Permanently added the RSA host key for IP address ‘192.168.25.*’ to the list of known hosts. Pe

Java小白學習記錄java在cmd中錯誤: 需要class, interface或enum

  第一天學習java,按照書中打下了第一個Java的Helloword: public class Helloword { public static void main(String args[]) { System.out.println("Wel