关于在android中service开发的IllegalArgumentException错误和服务无法启动的解释(转)

mac2022-06-30  23

当执行.unbindService(mConnection);时报告如下异常:

java.lang.RuntimeException: Unable to destroy activity {com.symbio.kkbox.ui/com.symbio.kkbox.ui.PlayerActivity}: java.lang.IllegalArgumentException: Service not registered:

需要getApplicationContext().unbindService(mConnection);来提升应用程序级别。同理,bindservice也需要提升到applicationcontext级别,还应需要注意你的代码逻辑是否正确,如当在同一Activity中,在onDestory中销毁时出现逻辑错误,返回前一个时进行销毁出错等原因

转载于:https://www.cnblogs.com/LeeYZ/archive/2013/01/25/2876376.html

最新回复(0)