AndroidStudio关于EventBus报错解决方法its super classes have no public methods with the @Subscribe

来源:互联网 发布:linux的ftp权限设置 编辑:程序博客网 时间:2024/06/05 14:18

今天使用EventBus,这行报错:

EventBus.getDefault().register(this);

查看日志显示,its super classes have no public methods with the @Subscribe annotation

虽说有提示,但还是一头雾水,只能一步一步踩坑了。经过不断试错,终于找到问题所在:
EventBus接收消息的方法,即使用@Subscribe注解的方法,必须是公共方法,否则会报错!

希望我踩过的坑可以帮到别人。如有不对,请多指教!

阅读全文
0 0