2013-07-18 81 views
0

我的應用程序成功運行,但是如果我把我的應用程序的理想狀態,持續3〜5分鐘,那就說明很不幸您的應用程序已經停止,在我的應用程序使用的服務,的AsyncTask的概念,你可以在下面的數據的Android服務泄漏

觀察員
07-18 05:00:12.779: W/ActivityManager(277): Unbind failed: could not find connection for [email protected] 
07-18 05:00:12.779: E/ActivityThread(692): Service com.android.exchange.ExchangeService has leaked ServiceConnection [email protected]48ec8 that was originally bound here 
07-18 05:00:12.779: E/ActivityThread(692): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection [email protected]48ec8 that was originally bound here 
07-18 05:00:12.779: E/ActivityThread(692): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969) 
07-18 05:00:12.779: E/ActivityThread(692): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863) 
07-18 05:00:12.779: E/ActivityThread(692): at android.app.ContextImpl.bindService(ContextImpl.java:1418) 
07-18 05:00:12.779: E/ActivityThread(692): at android.app.ContextImpl.bindService(ContextImpl.java:1407) 
07-18 05:00:12.779: E/ActivityThread(692): at android.content.ContextWrapper.bindService(ContextWrapper.java:473) 
07-18 05:00:12.779: E/ActivityThread(692): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157) 
07-18 05:00:12.779: E/ActivityThread(692): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145) 
07-18 05:00:12.779: E/ActivityThread(692): at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116) 
07-18 05:00:12.779: E/ActivityThread(692): at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249) 
07-18 05:00:12.779: E/ActivityThread(692): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856) 
07-18 05:00:12.779: E/ActivityThread(692): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551) 
07-18 05:00:12.779: E/ActivityThread(692): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549) 
07-18 05:00:12.779: E/ActivityThread(692): at android.os.AsyncTask$2.call(AsyncTask.java:287) 
07-18 05:00:12.779: E/ActivityThread(692): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 
07-18 05:00:12.779: E/ActivityThread(692): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 
07-18 05:00:12.779: E/ActivityThread(692): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 
07-18 05:00:12.779: E/ActivityThread(692): at java.lang.Thread.run(Thread.java:856) 
07-18 05:00:12.870: E/StrictMode(692): null 
07-18 05:00:12.870: E/StrictMode(692): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection [email protected]48ec8 that was originally bound here 
07-18 05:00:12.870: E/StrictMode(692): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969) 
07-18 05:00:12.870: E/StrictMode(692): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863) 
07-18 05:00:12.870: E/StrictMode(692): at android.app.ContextImpl.bindService(ContextImpl.java:1418) 
07-18 05:00:12.870: E/StrictMode(692): at android.app.ContextImpl.bindService(ContextImpl.java:1407) 
07-18 05:00:12.870: E/StrictMode(692): at android.content.ContextWrapper.bindService(ContextWrapper.java:473) 
07-18 05:00:12.870: E/StrictMode(692): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157) 
07-18 05:00:12.870: E/StrictMode(692): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145) 
07-18 05:00:12.870: E/StrictMode(692): at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116) 
07-18 05:00:12.870: E/StrictMode(692): at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249) 
07-18 05:00:12.870: E/StrictMode(692): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856) 
07-18 05:00:12.870: E/StrictMode(692): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551) 
07-18 05:00:12.870: E/StrictMode(692): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549) 
07-18 05:00:12.870: E/StrictMode(692): at android.os.AsyncTask$2.call(AsyncTask.java:287) 
07-18 05:00:12.870: E/StrictMode(692): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 
07-18 05:00:12.870: E/StrictMode(692): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 
07-18 05:00:12.870: E/StrictMode(692): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 
07-18 05:00:12.870: E/StrictMode(692): at java.lang.Thread.run(Thread.java:856) 
07-18 05:00:12.879: D/dalvikvm(692): GC_CONCURRENT freed 474K, 21% free 2476K/3096K, paused 74ms+75ms, total 197ms 
07-18 05:00:12.879: W/ActivityManager(277): Unbind failed: could not find connection for [email protected] 

幫助如何克服這種錯誤

回答

0

取消綁定/註銷服務的onStop()