报错:was originally bound here

2019-09-18 10:22:47.562 10511-10511/com.abc.www.xxx E/ActivityThread: Activity com.abc.www.xxx.activity.login.LoginActivity has leaked ServiceConnection com.abc.www.xxx.activity.login.LoginActivity$12@a57f5c that was originally bound here
    android.app.ServiceConnectionLeaked: Activity com.abc.www.xxx.activity.login.LoginActivity has leaked ServiceConnection com.abc.www.xxx.activity.login.LoginActivity$12@a57f5c that was originally bound here
        at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:1538)
        at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:1430)
        at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1622)
        at android.app.ContextImpl.bindService(ContextImpl.java:1574)
        at android.content.ContextWrapper.bindService(ContextWrapper.java:697)
        at com.abc.www.xxx.activity.login.LoginActivity.bindService(LoginActivity.java:885)
        at com.abc.www.xxx.activity.login.LoginActivity.onCreate(LoginActivity.java:185)
        at android.app.Activity.performCreate(Activity.java:7183)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1220)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2910)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3032)
        at android.app.ActivityThread.-wrap11(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696)
        at android.os.Handler.dispatchMessage(Handler.java:105)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6944)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

如果在activity中绑定了服务,而没有在destory中,写unbind,会出现这种异常。在onDestroy方法中加入了对服务的解绑操作即 unbindService就成功解决了。
dialog中如果activity已经finish()掉但dialog还没dissmiss()时也会报类似的溢出错误

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值