当前位置:编程学习 > wap >>

ANDROID程序出现“很抱歉,XXX已停止运行”这个是什么原因?

程序是在2.2上开发的,在2.2,,2。3.3都没有出现过这种现象,
在4.0.3上,打开程序后放在后台,偶尔就回出现
“很抱歉,XXX已停止运行”的提示

一般是什么原因会造成这个问题呢 android --------------------编程问答-------------------- 为何不看logcat --------------------编程问答-------------------- 就是报个错,很正常啊 --------------------编程问答-------------------- 我表示 调试的时候经常出现这个情况,说明程序有错误。 --------------------编程问答-------------------- 各种原因都有~ --------------------编程问答--------------------
引用 楼主 RomanticRabbit 的回复:
程序是在2.2上开发的,在2.2,,2。3.3都没有出现过这种现象,
在4.0.3上,打开程序后放在后台,偶尔就回出现
“很抱歉,XXX已停止运行”的提示

一般是什么原因会造成这个问题呢 
android


我也遇到过,不过我是刚开始学习Android编程,很多不知道,感觉是该输的东西没有输完造成的 --------------------编程问答-------------------- 很有可能是抛异常了 --------------------编程问答-------------------- 就是抛异常,什么找不到对象啊,空指针啊,类型不匹配啊,数组越界等等。 --------------------编程问答-------------------- 谢谢各位,找到问题了,
是在用INTENT启动service的时候
官方文档说   The Intent supplied to startService(Intent), as given. This may be null if the service is being restarted after its process has gone away, and it had previously returned anything except START_STICKY_COMPATIBILITY.

某个时候方法onStart()已经deprecated,在Android 2.0之后被onStartCommand所取代。onStartCommand为了backwards compatibility,默认实现是去call onStart方法,并且会在最后返回START_STICKY or START_STICKY_COMPATIBILIT

要加入对intent空指针的保护 --------------------编程问答--------------------
引用 8 楼 RomanticRabbit 的回复:
谢谢各位,找到问题了,
是在用INTENT启动service的时候
官方文档说   The Intent supplied to startService(Intent), as given. This may be null if the service is being restarted after its process has gone away, and ……



...我倒觉得问题在于你为什么会传递NULL的Intent引用,不要加个判断就把真正的问题掩盖了 --------------------编程问答-------------------- 看logcat在log,一般里面都会报exception. --------------------编程问答--------------------
引用 9 楼 freebendy 的回复:
引用 8 楼 RomanticRabbit 的回复:
谢谢各位,找到问题了,
是在用INTENT启动service的时候
官方文档说   The Intent supplied to startService(Intent), as given. This may be null if the service is being restarted after its process has ……


 This may be null if the service is being restarted after its process has gone away

这是在service被system restart的时候 和前面传递intent没关系的
很烦官方文档的maybe这词 --------------------编程问答-------------------- 问题很多。。 --------------------编程问答--------------------
引用 11 楼 RomanticRabbit 的回复:
Quote: 引用 9 楼 freebendy 的回复:

引用 8 楼 RomanticRabbit 的回复:
谢谢各位,找到问题了,
是在用INTENT启动service的时候
官方文档说   The Intent supplied to startService(Intent), as given. This may be null if the service is being restarted after its process has ……


 This may be null if the service is being restarted after its process has gone away

这是在service被system restart的时候 和前面传递intent没关系的
很烦官方文档的maybe这词


对,之前也被坑过。。 --------------------编程问答-------------------- 用360手机卫士[内存清理]→手机加速→一键加速→OK完美解决 --------------------编程问答-------------------- 看看logcat是什么错误 --------------------编程问答-------------------- 连接手机助手,下载安装一款修复软件,打开就自动修复了。 --------------------编程问答-------------------- 有可能是异常没有catch造成的 --------------------编程问答-------------------- 不知道各位大牛们找到有效的解决办法没,我的还是出错啊~~ --------------------编程问答-------------------- 接分!!!!!!!
补充:移动开发 ,  Android
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,