Android 模拟器向 logcat 发送垃圾邮件,内容为“Service com.android.exchange.ExchangeService has leaked ServiceConnec
Posted
技术标签:
【中文标题】Android 模拟器向 logcat 发送垃圾邮件,内容为“Service com.android.exchange.ExchangeService has leaked ServiceConnection ... that original bound here【英文标题】:Android emulator spams logcat with "Service com.android.exchange.ExchangeService has leaked ServiceConnection ... that was originally bound here 【发布时间】:2012-12-07 14:32:22 【问题描述】:我正在开发一个非常简单的 android 应用程序。我制作了一个启动画面、主菜单和一个带有单选按钮和一个按钮的页面(根据选中的单选按钮播放声音)。该应用程序工作正常(不会崩溃),但我在 logcat 中一直遇到所有这些错误(我使用模拟器运行应用程序)。那会是什么?我该如何解决?我应该担心吗?当有人询问时,我会另外发布代码,因为我不知道问题可能出在哪里,并且我不想无缘无故地将所有 .java 和 xml 文件发布到垃圾邮件中。
logcat 中的错误:
12-07 14:24:28.301: E/ActivityThread(587): Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d0c8d8 that was originally bound here
12-07 14:24:28.301: E/ActivityThread(587): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d0c8d8 that was originally bound here
12-07 14:24:28.301: E/ActivityThread(587): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
12-07 14:24:28.301: E/ActivityThread(587): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
12-07 14:24:28.301: E/ActivityThread(587): at android.app.ContextImpl.bindService(ContextImpl.java:1418)
12-07 14:24:28.301: E/ActivityThread(587): at android.app.ContextImpl.bindService(ContextImpl.java:1407)
12-07 14:24:28.301: E/ActivityThread(587): at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
12-07 14:24:28.301: E/ActivityThread(587): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
12-07 14:24:28.301: E/ActivityThread(587): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
12-07 14:24:28.301: E/ActivityThread(587): at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116)
12-07 14:24:28.301: E/ActivityThread(587): at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249)
12-07 14:24:28.301: E/ActivityThread(587): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856)
12-07 14:24:28.301: E/ActivityThread(587): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
12-07 14:24:28.301: E/ActivityThread(587): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
12-07 14:24:28.301: E/ActivityThread(587): at android.os.AsyncTask$2.call(AsyncTask.java:287)
12-07 14:24:28.301: E/ActivityThread(587): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
12-07 14:24:28.301: E/ActivityThread(587): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
12-07 14:24:28.301: E/ActivityThread(587): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
12-07 14:24:28.301: E/ActivityThread(587): at java.lang.Thread.run(Thread.java:856)
12-07 14:24:28.312: E/StrictMode(587): null
12-07 14:24:28.312: E/StrictMode(587): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d0c8d8 that was originally bound here
12-07 14:24:28.312: E/StrictMode(587): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
12-07 14:24:28.312: E/StrictMode(587): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
12-07 14:24:28.312: E/StrictMode(587): at android.app.ContextImpl.bindService(ContextImpl.java:1418)
12-07 14:24:28.312: E/StrictMode(587): at android.app.ContextImpl.bindService(ContextImpl.java:1407)
12-07 14:24:28.312: E/StrictMode(587): at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
12-07 14:24:28.312: E/StrictMode(587): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
12-07 14:24:28.312: E/StrictMode(587): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
12-07 14:24:28.312: E/StrictMode(587): at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116)
12-07 14:24:28.312: E/StrictMode(587): at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249)
12-07 14:24:28.312: E/StrictMode(587): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856)
12-07 14:24:28.312: E/StrictMode(587): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
12-07 14:24:28.312: E/StrictMode(587): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
12-07 14:24:28.312: E/StrictMode(587): at android.os.AsyncTask$2.call(AsyncTask.java:287)
12-07 14:24:28.312: E/StrictMode(587): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
12-07 14:24:28.312: E/StrictMode(587): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
12-07 14:24:28.312: E/StrictMode(587): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
12-07 14:24:28.312: E/StrictMode(587): at java.lang.Thread.run(Thread.java:856)
12-07 14:24:28.312: W/ActivityManager(273): Unbind failed: could not find connection for android.os.BinderProxy@40f409d8
12-07 14:24:28.322: E/ActivityThread(587): Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d5ed58 that was originally bound here
12-07 14:24:28.322: E/ActivityThread(587): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d5ed58 that was originally bound here
12-07 14:24:28.322: E/ActivityThread(587): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
12-07 14:24:28.322: E/ActivityThread(587): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
12-07 14:24:28.322: E/ActivityThread(587): at android.app.ContextImpl.bindService(ContextImpl.java:1418)
12-07 14:24:28.322: E/ActivityThread(587): at android.app.ContextImpl.bindService(ContextImpl.java:1407)
12-07 14:24:28.322: E/ActivityThread(587): at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
12-07 14:24:28.322: E/ActivityThread(587): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
12-07 14:24:28.322: E/ActivityThread(587): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
12-07 14:24:28.322: E/ActivityThread(587): at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191)
12-07 14:24:28.322: E/ActivityThread(587): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850)
12-07 14:24:28.322: E/ActivityThread(587): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
12-07 14:24:28.322: E/ActivityThread(587): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
12-07 14:24:28.322: E/ActivityThread(587): at android.os.AsyncTask$2.call(AsyncTask.java:287)
12-07 14:24:28.322: E/ActivityThread(587): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
12-07 14:24:28.322: E/ActivityThread(587): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
12-07 14:24:28.322: E/ActivityThread(587): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
12-07 14:24:28.322: E/ActivityThread(587): at java.lang.Thread.run(Thread.java:856)
12-07 14:24:28.341: E/StrictMode(587): null
12-07 14:24:28.341: E/StrictMode(587): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d5ed58 that was originally bound here
12-07 14:24:28.341: E/StrictMode(587): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
12-07 14:24:28.341: E/StrictMode(587): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
12-07 14:24:28.341: E/StrictMode(587): at android.app.ContextImpl.bindService(ContextImpl.java:1418)
12-07 14:24:28.341: E/StrictMode(587): at android.app.ContextImpl.bindService(ContextImpl.java:1407)
12-07 14:24:28.341: E/StrictMode(587): at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
12-07 14:24:28.341: E/StrictMode(587): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
12-07 14:24:28.341: E/StrictMode(587): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
12-07 14:24:28.341: E/StrictMode(587): at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191)
12-07 14:24:28.341: E/StrictMode(587): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850)
12-07 14:24:28.341: E/StrictMode(587): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
12-07 14:24:28.341: E/StrictMode(587): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
12-07 14:24:28.341: E/StrictMode(587): at android.os.AsyncTask$2.call(AsyncTask.java:287)
12-07 14:24:28.341: E/StrictMode(587): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
12-07 14:24:28.341: E/StrictMode(587): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
12-07 14:24:28.341: E/StrictMode(587): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
12-07 14:24:28.341: E/StrictMode(587): at java.lang.Thread.run(Thread.java:856)
【问题讨论】:
我在此日志中看不到任何与您的应用相关的内容。这些错误似乎与android本身的ExchangeService有关。 @AleksG 是的,我就是这么想的,但是——我应该闭上眼睛吗?我不认为出现这么多错误是正常的。 不,这不正常,但我认为它们与您的应用程序无关,因此忽略它们可能没问题。不过可以肯定的是,请尝试在实际手机上测试您的应用,看看会发生什么。 @AleksG 好的,谢谢。如果其他人有一些想法或解决方案,请提供帮助。 您应该将@Nuthatch 标记为正确 【参考方案1】:更简单的解决方法是在设置:应用:全部下的模拟设备中禁用“Exchange 服务”
(您可能需要滑动才能看到“全部”标签)
【讨论】:
这应该被选为正确答案。我遇到了这个问题,为此创建另一个模拟器不是一个好的解决方案。 @ThorstenNiehues:当我转到设置 -> 应用程序时,有 3 个选项卡:已下载、正在运行和全部。该过程位于“全部”选项卡中。 这行得通!它绝对应该被标记为正确答案! 我不想承认这一点,但我在 IDE 中寻找此设置。我会为其他和我一样慢的人指出。这是在实际的模拟器上。 :) @vikingben 哦,好点。我已经更新了我的答案,以使这一点更清楚。谢谢!【参考方案2】:在我删除当前的模拟器设备之前,没有任何帮助。之后,我设置了一个全新的虚拟设备。我的新模拟器设备没有所有这些错误。这解决了我的问题。
【讨论】:
我遇到了同样的问题,并通过删除“使用主机 GPU”选项解决了它。 @Mr_Qqn 感谢您的提示!如果需要,我会尝试,但我当然希望不会。 @Mr_Qqn 你的意思是设备设置(在设备管理器中)中的复选框“使用主机 GPU”如果是这样的话 - 它对我没有帮助:( @user1880779 当我创建一个新的 AVD thnks 时,我的问题也得到了解决【参考方案3】:在我的情况下,关闭防火墙(我使用 Windows 8 机器和最新的 Android SDK,4.2)。
【讨论】:
【参考方案4】:围绕这个错误搜索了 60 分钟后,我发现我只是有一个无限循环,导致此交换服务垃圾邮件,直到应用程序关闭。把这个留在这里,以防其他人想太多
【讨论】:
【参考方案5】:这可能是模拟器中的误导性错误消息。
我很困惑,直到我连接了一个实际的设备,它同时崩溃了,而是抱怨缺少使用权限。添加使用权限解决了这个问题。
这不会是所有用户的问题根源,但可能是某些用户的问题。
【讨论】:
以上是关于Android 模拟器向 logcat 发送垃圾邮件,内容为“Service com.android.exchange.ExchangeService has leaked ServiceConnec的主要内容,如果未能解决你的问题,请参考以下文章