【Android】AndroidStudio关于EventBus报错解决方法its super classes have no public methods with the @Subscribe
作者:程序员小冰,GitHub主页:https://github.com/QQ986945193
新浪微博:http://weibo.com/mcxiaobing
首先说明,以前我用eventBus的jar包写得项目demo,前几天就写了一个EventBus的实例,这次我没用jar包,直接用gradle引用的,可是demo写完了,报错:
its super classes have no public methods with the @Subscribe annotation
所以就用google搜索了一下,找到了解决方法,那就是在接受者
onEvent()方法添加注解: @Subscribe 然后问题解决,如:
/**
*
* 从发布者那里得到eventbus传送过来的数据
*
* 加上@Subscribe以防报错:its super classes have no public methods with the @Subscribe annotation
*
* @param event
*/
@Subscribe
public void onEvent(String event){
tv.setText(event);
}
效果图如下:
eventBus简单使用实例demo需要的可以直接去下载:
(AndroidStudio版)github下载地址:
https://github.com/QQ986945193/DavidEventBusDemo
(AndroidStudio版)git开源中国下载地址:
http://git.oschina.net/MCXIAOBING/DavidEventBusDemo
(AndroidStudio版)CSDN免积分下载地址:
http://download.csdn.net/detail/qq_21376985/9623446
【Android】AndroidStudio关于EventBus报错解决方法its super classes have no public methods with the @Subscribe的更多相关文章
- AndroidStudio EventBus报错解决方法its super classes have no public methods with the @Subscribe
首先说明,以前我用eventBus的jar包写得项目demo,前几天就写了一个EventBus的实例,这次我没用jar包,直接用gradle引用的,可是demo写完了,报错: its super cl ...
- Android Studio support 26.0.0-alpha1 Failed to resolve: com.android.support:appcompat-v7:27.+ 报错解决方法
AS下如何生成自定义的.jks签名文件, 以及如何生成数字签名 链接:http://www.cnblogs.com/smyhvae/p/4456420.html 链接:http://blog.csdn ...
- Failed to resolve: com.android.support:appcompat-v7:27.+ 报错解决方法
最近在学习Android方面的编程,这个过程中出现了许多的错误,其中最多的错误是出现在构建工具进行编译的时候.这里分析一个出现的错误,Failed to resolve: com.android.su ...
- Android开发过程中部分报错解决方法。
初学Android,最近在使用zxing开发一个条码扫描解析的安卓项目中,遇到以下几个问题.贴出来以供参考. 1.Http请求错误 Android4.0以上要求不能把网络请求的操作放在主线程里操 ...
- eclipse创建的maven项目,pom.xml文件报错解决方法
[错误一:]maven 编译级别过低 [解决办法:] 使用 maven-compiler-plugin 将 maven 编译级别改为 jdk1.6 以上: <!-- java编译插件 --> ...
- MyEclipse Server view报错解决方法
MyEclipse Server view报错解决方法 方法/步骤 启动MyEclipse,弹出一个框,报错. ---------------------------------------- ...
- Loadrunner参数化逗号报错解决方法
Loadrunner参数化逗号报错解决方法 介绍Loadrunner参数化时,参数中包含有逗号时出错的解决方法. 在Loadrunner进行参数化时,参数中如果含有逗号,编辑保存后会报错: 此 ...
- iOS url带中文下载时 报错解决方法
问题描述:下载文件时, 请求带中文的URL的资源时,比如:http://s237.sznews.com/pic/2010/11/23/e4fa5794926548ac953a8a525a23b6f2/ ...
- jquery jssdk分享报错解决方法
jssdk分享报错解决方法 一般都是参数传错了
随机推荐
- Idea debug报错Command line is too long
问题: 使用idea开发Java项目,写单元测试,debug时,会有红字报错:Command line is too long 解决方法: 在项目的目录下,找到/.idea/workspace.xml ...
- Spring中使用MyBatis Generator
简介 MyBatis Generator 是由MyBatis官方提供的MyBatis代码生成器.可以根据数据库表生成相关代码,比如POJO.Mapper接口.SQL Map xml等. 使用方式 MB ...
- jpa jpql @query 动态查询
需求/背景 假设有一个用户表, 对应的用户实体: public class User { @Id Long id; //姓名 String name; //性别,男0女1 String sex; // ...
- 12、Decorator 装饰器 模式 装饰起来美美哒 结构型设计模式
1.Decorator模式 装饰模式又名包装(Wrapper)模式.装饰模式以对客户端透明的方式扩展对象的功能,是继承关系的一个替代方案. 装饰器模式(Decorator Pattern)允许向一个现 ...
- Tomcat Windows 开机自启
在命令提示符中,进入 tomcat 的 bin 目录,执行命令,注册服务 service.bat install 在"服务"中,将 tomcat 服务设为自动
- C#LeetCode刷题之#34-在排序数组中查找元素的第一个和最后一个位置(Find First and Last Position of Element in Sorted Array)
问题 该文章的最新版本已迁移至个人博客[比特飞],单击链接 https://www.byteflying.com/archives/4970 访问. 给定一个按照升序排列的整数数组 nums,和一个目 ...
- C#LeetCode刷题之#453-最小移动次数使数组元素相等(Minimum Moves to Equal Array Elements)
问题 该文章的最新版本已迁移至个人博客[比特飞],单击链接 https://www.byteflying.com/archives/3877 访问. 给定一个长度为 n 的非空整数数组,找到让数组所有 ...
- C#LeetCode刷题之#389-找不同(Find the Difference)
问题 该文章的最新版本已迁移至个人博客[比特飞],单击链接 https://www.byteflying.com/archives/4062 访问. 给定两个字符串 s 和 t,它们只包含小写字母. ...
- DeepLab系列
论文: (DeepLabV1)Semantic image segmentation with deep convolutional nets and fully connected CRFs (De ...
- MySQL元数据信息
一.查看数据库清单 show databases; 二.查看数据库下表清单 方法1) show full tables from ${schema名}; 方法2) use ${数据库名}; show ...