泄露了最初绑定在这里的ServiceConnection

时间:2015-01-14 20:30:59

标签: java android

我打开一个应用程序做某事,不知何故应用程序崩溃。我再次打开它并得到此错误。我想知道这个错误的原因和解决方案。任何人都可以帮忙。

   15 01:25:59.698  31122-31122/com.myApp.myApp E/ActivityThread﹕ Activity com.myApp.myApp.Main has leaked ServiceConnection com.google.android.gms.common.a@412XXfa8 that was originally bound here
    android.app.ServiceConnectionLeaked: Activity com.myApp.myApp.Main has leaked ServiceConnection com.google.android.gms.common.a@412XXfa8 that was originally bound here
            at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
            at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
            at android.app.ContextImpl.bindService(ContextImpl.java:1470)
            at android.app.ContextImpl.bindService(ContextImpl.java:1459)
            at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
            at com.google.android.gms.ads.identifier.AdvertisingIdClient.h(Unknown Source)
            at com.google.android.gms.ads.identifier.AdvertisingIdClient.b(Unknown Source)
            at com.google.android.gms.ads.identifier.AdvertisingIdClient.getAdvertisingIdInfo(Unknown Source)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.facebook.internal.Utility.invokeMethodQuietly(Utility.java:899)
            at com.facebook.internal.AttributionIdentifiers.getAndroidId(AttributionIdentifiers.java:85)
            at com.facebook.internal.AttributionIdentifiers.getAttributionIdentifiers(AttributionIdentifiers.java:110)
            at com.facebook.AppEventsLogger.getSessionEventsState(AppEventsLogger.java:751)
            at com.facebook.AppEventsLogger.access$600(AppEventsLogger.java:127)
            at com.facebook.AppEventsLogger$5.run(AppEventsLogger.java:708)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
            at java.lang.Thread.run(Thread.java:856)

1 个答案:

答案 0 :(得分:2)

取消绑定onStop()或onDestroy()

上的服务连接
unBindService(connection);