Android开发错误记录:MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
来源:互联网 发布:淘宝网的卖家中心在哪 编辑:程序博客网 时间:2024/06/08 08:29
今天遇到了一个头疼的问题,就是本来程序昨天都是好好的,但是今天在该页面退出的时候就报通道破碎错误了,直接闪屏,头大,上网搜了一下资料,再结合昨晚写的代码,预估可能是网络请求的问题,搞了半天解决了,记录一下。
报错记录
05-25 10:52:21.125 491-528/system_process E/InputDispatcher: channel '4a8b59f4 activity.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed! 05-25 10:52:21.125 491-528/system_process E/InputDispatcher: channel '4a9790c4 activity.ShoppingCartActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
出错位置
private Handler mHandler = new Handler(){ @Override public void handleMessage(Message msg) { super.handleMessage(msg); switch (msg.what){ case KEY: if (ispay) { Map<String, String> param = new HashMap<>(); String orderId = SharePreferenceUtils.readString(PayActivity.this, "user", "orderId"); param.put("orderId",orderId); PayActivity.this.post(Api.PayResult,param, PayResultBean.class); } break; default: break; } } };
这行网络请求(这是我写的一个xutils封装类里的post请求方法)出了问题:
PayActivity.this.post(Api.PayResult,param, PayResultBean.class);
具体原因就是因为页面在退出的时候,该行代码依然在执行,所以报错,紧急之下也没做其他的处理,只是写了一个标志位,在页面退出的时候设置为false,这个方法其实不太好,暂时先这样,后期改进。
@Override protected void onDestroy() { super.onDestroy(); ispay = false; }
解决问题思路
改正后,就不在报那个错了,从报这个错误消息的情况来看,如果程序报Channel is unrecoverably broken and will be disposed!时,首先可以考虑是不是代码中某个有数据输入或是有数据输出的地方,写错了代码。
稍做补充
下午又遇到这个问题了,看了一下,原来是后台接口数据做了改动,我重新生成bean对象的时候,有个为long类型的数据变成了String类型我也没注意到,改正过来就好了。写代码细心很重要,引以为戒,下不为例。
阅读全文
0 0
- Android开发错误记录:MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
- 开发错误记录2 .MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
- Android错误:Channel is unrecoverably broken and will be disposed!
- InputDispatcher: MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
- Android Channel is unrecoverably broken and will be disposed!问题解决
- Android Exception 10((server)' ~ Channel is unrecoverably broken and will be disposed!)
- channel ~ Channel is unrecoverably broken and will be disposed!
- Channel is unrecoverably broken and will be disposed!
- Channel is unrecoverably broken and will be disposed!
- Channel is unrecoverably broken and will be disposed!
- Channel is unrecoverably broken and will be disposed!
- Channel is unrecoverably broken and will be disposed!
- Channel is unrecoverably broken and will be disposed
- Channel is unrecoverably broken and will be disposed!
- Android 程序报错:Channel is unrecoverably broken and will be disposed!
- E/InputDispatcher: channel '32d434a4 Toast (server)' ~ Channel is unrecoverably broken and will be d
- Consumer closed input channel or an error occurred/Channel is unrecoverably broken and will be dispo
- channel '537f2e7c com.xxxxx.xxxxx/com.xxxxx.xxxxx.AppActivity (server)' ~ Channel is unrecoverably b
- BZOJ3402: [Usaco2009 Open]Hide and Seek 捉迷藏
- 单点登录原理与简单实现
- Java Linux 时区同步设置和重启 arm端
- 关于NetKeeper(创翼)升级后,无法共享WIFI问题的解决-猎豹、360都可
- 服务器常用状态码以及它的含义
- Android开发错误记录:MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
- Java虚拟机笔记--2
- Spring 注解大全
- QTP应用实例-G.8032测试自动化(4)数据扩展
- 将多个jar包重新打包成一个jar包
- 《Kali+Linux渗透测试的艺术》学习总结之----概要
- 新闻客户端(AsyncHttpClient和SmartImageView的综合使用
- zookeeper集群(二)
- 灰度发布