0

gmailメッセージにアクセスする必要があるAndroidアプリケーションについて勉強しています。このようなクラスを作成し、アクティビティのonCreate()メソッドから呼び出します。

MessageBox.java

   public void startConnection(String userName, String password) throws MessagingException {

            Properties properties = System.getProperties();
            properties.setProperty("mail.store.protocol", "imaps");
            properties.setProperty("mail.imaps.host","imaps.gmail.com");
            properties.setProperty("mail.imaps.quitwait", "false");
            properties.put("mail.imaps.auth", "true"); 
            properties.put("mail.imaps.port", "993"); 
            properties.put("mail.imaps.socketFactory.port", "993"); 
            properties.put("mail.imaps.socketFactory.class", 
                      "javax.net.ssl.SSLSocketFactory"); 
            properties.put("mail.imaps.socketFactory.fallback", "false"); 
            session = Session.getDefaultInstance(properties, null);

                store = session.getStore("imaps");
   **Problem in here**  store.connect("imap.gmail.com", userName, password);
        }

マイアクティビティ

       try  {
            messageBox.startConnection("username","password");

        } catch (MessagingException e) {
            e.printStackTrace();
        }

ここで何が間違っていますか?前もって感謝します

編集:LogCatから

06-06 12:31:11.125: E/ThrottleService(289): problem during onPollAlarm: java.lang.IllegalStateException: problem parsing stats: java.io.FileNotFoundException: /proc/net/xt_qtaguid/iface_stat_all: open failed: ENOENT (No such file or directory)
06-06 12:31:13.493: E/ActivityThread(653): Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d085b0 that was originally bound here
06-06 12:31:13.493: E/ActivityThread(653): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d085b0 that was originally bound here
06-06 12:31:13.493: E/ActivityThread(653):  at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
06-06 12:31:13.493: E/ActivityThread(653):  at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
06-06 12:31:13.493: E/ActivityThread(653):  at android.app.ContextImpl.bindService(ContextImpl.java:1418)
06-06 12:31:13.493: E/ActivityThread(653):  at android.app.ContextImpl.bindService(ContextImpl.java:1407)
06-06 12:31:13.493: E/ActivityThread(653):  at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
06-06 12:31:13.493: E/ActivityThread(653):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
06-06 12:31:13.493: E/ActivityThread(653):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
06-06 12:31:13.493: E/ActivityThread(653):  at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116)
06-06 12:31:13.493: E/ActivityThread(653):  at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249)
06-06 12:31:13.493: E/ActivityThread(653):  at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856)
06-06 12:31:13.493: E/ActivityThread(653):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
06-06 12:31:13.493: E/ActivityThread(653):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
06-06 12:31:13.493: E/ActivityThread(653):  at android.os.AsyncTask$2.call(AsyncTask.java:287)
06-06 12:31:13.493: E/ActivityThread(653):  at java.util.concurrent.FutureTask.run(FutureTask.java:234)
06-06 12:31:13.493: E/ActivityThread(653):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
06-06 12:31:13.493: E/ActivityThread(653):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
06-06 12:31:13.493: E/ActivityThread(653):  at java.lang.Thread.run(Thread.java:856)
06-06 12:31:13.524: E/StrictMode(653): null
06-06 12:31:13.524: E/StrictMode(653): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d085b0 that was originally bound here
06-06 12:31:13.524: E/StrictMode(653):  at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
06-06 12:31:13.524: E/StrictMode(653):  at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
06-06 12:31:13.524: E/StrictMode(653):  at android.app.ContextImpl.bindService(ContextImpl.java:1418)
06-06 12:31:13.524: E/StrictMode(653):  at android.app.ContextImpl.bindService(ContextImpl.java:1407)
06-06 12:31:13.524: E/StrictMode(653):  at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
06-06 12:31:13.524: E/StrictMode(653):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
06-06 12:31:13.524: E/StrictMode(653):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
06-06 12:31:13.524: E/StrictMode(653):  at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116)
06-06 12:31:13.524: E/StrictMode(653):  at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249)
06-06 12:31:13.524: E/StrictMode(653):  at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856)
06-06 12:31:13.524: E/StrictMode(653):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
06-06 12:31:13.524: E/StrictMode(653):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
06-06 12:31:13.524: E/StrictMode(653):  at android.os.AsyncTask$2.call(AsyncTask.java:287)
06-06 12:31:13.524: E/StrictMode(653):  at java.util.concurrent.FutureTask.run(FutureTask.java:234)
06-06 12:31:13.524: E/StrictMode(653):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
06-06 12:31:13.524: E/StrictMode(653):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
06-06 12:31:13.524: E/StrictMode(653):  at java.lang.Thread.run(Thread.java:856)
06-06 12:31:13.565: E/ActivityThread(653): Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d080d8 that was originally bound here
06-06 12:31:13.565: E/ActivityThread(653): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d080d8 that was originally bound here
06-06 12:31:13.565: E/ActivityThread(653):  at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
06-06 12:31:13.565: E/ActivityThread(653):  at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
06-06 12:31:13.565: E/ActivityThread(653):  at android.app.ContextImpl.bindService(ContextImpl.java:1418)
06-06 12:31:13.565: E/ActivityThread(653):  at android.app.ContextImpl.bindService(ContextImpl.java:1407)
06-06 12:31:13.565: E/ActivityThread(653):  at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
06-06 12:31:13.565: E/ActivityThread(653):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
06-06 12:31:13.565: E/ActivityThread(653):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
06-06 12:31:13.565: E/ActivityThread(653):  at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191)
06-06 12:31:13.565: E/ActivityThread(653):  at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850)
06-06 12:31:13.565: E/ActivityThread(653):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
06-06 12:31:13.565: E/ActivityThread(653):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
06-06 12:31:13.565: E/ActivityThread(653):  at android.os.AsyncTask$2.call(AsyncTask.java:287)
06-06 12:31:13.565: E/ActivityThread(653):  at java.util.concurrent.FutureTask.run(FutureTask.java:234)
06-06 12:31:13.565: E/ActivityThread(653):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
06-06 12:31:13.565: E/ActivityThread(653):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
06-06 12:31:13.565: E/ActivityThread(653):  at java.lang.Thread.run(Thread.java:856)
06-06 12:31:13.613: E/StrictMode(653): null
06-06 12:31:13.613: E/StrictMode(653): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d080d8 that was originally bound here
06-06 12:31:13.613: E/StrictMode(653):  at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
06-06 12:31:13.613: E/StrictMode(653):  at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
06-06 12:31:13.613: E/StrictMode(653):  at android.app.ContextImpl.bindService(ContextImpl.java:1418)
06-06 12:31:13.613: E/StrictMode(653):  at android.app.ContextImpl.bindService(ContextImpl.java:1407)
06-06 12:31:13.613: E/StrictMode(653):  at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
06-06 12:31:13.613: E/StrictMode(653):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
06-06 12:31:13.613: E/StrictMode(653):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
06-06 12:31:13.613: E/StrictMode(653):  at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191)
06-06 12:31:13.613: E/StrictMode(653):  at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850)
06-06 12:31:13.613: E/StrictMode(653):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
06-06 12:31:13.613: E/StrictMode(653):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
06-06 12:31:13.613: E/StrictMode(653):  at android.os.AsyncTask$2.call(AsyncTask.java:287)
06-06 12:31:13.613: E/StrictMode(653):  at java.util.concurrent.FutureTask.run(FutureTask.java:234)
06-06 12:31:13.613: E/StrictMode(653):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
06-06 12:31:13.613: E/StrictMode(653):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
06-06 12:31:13.613: E/StrictMode(653):  at java.lang.Thread.run(Thread.java:856)
06-06 12:32:03.693: E/ActivityThread(653): Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d2ebc0 that was originally bound here
06-06 12:32:03.693: E/ActivityThread(653): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d2ebc0 that was originally bound here
06-06 12:32:03.693: E/ActivityThread(653):  at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
06-06 12:32:03.693: E/ActivityThread(653):  at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
06-06 12:32:03.693: E/ActivityThread(653):  at android.app.ContextImpl.bindService(ContextImpl.java:1418)
06-06 12:32:03.693: E/ActivityThread(653):  at android.app.ContextImpl.bindService(ContextImpl.java:1407)
06-06 12:32:03.693: E/ActivityThread(653):  at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
06-06 12:32:03.693: E/ActivityThread(653):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
06-06 12:32:03.693: E/ActivityThread(653):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
06-06 12:32:03.693: E/ActivityThread(653):  at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116)
06-06 12:32:03.693: E/ActivityThread(653):  at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249)
06-06 12:32:03.693: E/ActivityThread(653):  at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856)
06-06 12:32:03.693: E/ActivityThread(653):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
06-06 12:32:03.693: E/ActivityThread(653):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
06-06 12:32:03.693: E/ActivityThread(653):  at android.os.AsyncTask$2.call(AsyncTask.java:287)
06-06 12:32:03.693: E/ActivityThread(653):  at java.util.concurrent.FutureTask.run(FutureTask.java:234)
06-06 12:32:03.693: E/ActivityThread(653):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
06-06 12:32:03.693: E/ActivityThread(653):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
06-06 12:32:03.693: E/ActivityThread(653):  at java.lang.Thread.run(Thread.java:856)
06-06 12:32:03.863: E/StrictMode(653): null
06-06 12:32:03.863: E/StrictMode(653): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d2ebc0 that was originally bound here
06-06 12:32:03.863: E/StrictMode(653):  at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
06-06 12:32:03.863: E/StrictMode(653):  at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
06-06 12:32:03.863: E/StrictMode(653):  at android.app.ContextImpl.bindService(ContextImpl.java:1418)
06-06 12:32:03.863: E/StrictMode(653):  at android.app.ContextImpl.bindService(ContextImpl.java:1407)
06-06 12:32:03.863: E/StrictMode(653):  at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
06-06 12:32:03.863: E/StrictMode(653):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
06-06 12:32:03.863: E/StrictMode(653):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
06-06 12:32:03.863: E/StrictMode(653):  at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116)
06-06 12:32:03.863: E/StrictMode(653):  at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249)
06-06 12:32:03.863: E/StrictMode(653):  at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856)
06-06 12:32:03.863: E/StrictMode(653):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
06-06 12:32:03.863: E/StrictMode(653):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
06-06 12:32:03.863: E/StrictMode(653):  at android.os.AsyncTask$2.call(AsyncTask.java:287)
06-06 12:32:03.863: E/StrictMode(653):  at java.util.concurrent.FutureTask.run(FutureTask.java:234)
06-06 12:32:03.863: E/StrictMode(653):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
06-06 12:32:03.863: E/StrictMode(653):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
06-06 12:32:03.863: E/StrictMode(653):  at java.lang.Thread.run(Thread.java:856)
06-06 12:32:03.933: E/ActivityThread(653): Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d2e680 that was originally bound here
06-06 12:32:03.933: E/ActivityThread(653): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d2e680 that was originally bound here
06-06 12:32:03.933: E/ActivityThread(653):  at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
06-06 12:32:03.933: E/ActivityThread(653):  at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
06-06 12:32:03.933: E/ActivityThread(653):  at android.app.ContextImpl.bindService(ContextImpl.java:1418)
06-06 12:32:03.933: E/ActivityThread(653):  at android.app.ContextImpl.bindService(ContextImpl.java:1407)
06-06 12:32:03.933: E/ActivityThread(653):  at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
06-06 12:32:03.933: E/ActivityThread(653):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
06-06 12:32:03.933: E/ActivityThread(653):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
06-06 12:32:03.933: E/ActivityThread(653):  at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191)
06-06 12:32:03.933: E/ActivityThread(653):  at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850)
06-06 12:32:03.933: E/ActivityThread(653):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
06-06 12:32:03.933: E/ActivityThread(653):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
06-06 12:32:03.933: E/ActivityThread(653):  at android.os.AsyncTask$2.call(AsyncTask.java:287)
06-06 12:32:03.933: E/ActivityThread(653):  at java.util.concurrent.FutureTask.run(FutureTask.java:234)
06-06 12:32:03.933: E/ActivityThread(653):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
06-06 12:32:03.933: E/ActivityThread(653):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
06-06 12:32:03.933: E/ActivityThread(653):  at java.lang.Thread.run(Thread.java:856)
06-06 12:32:04.063: E/StrictMode(653): null
06-06 12:32:04.063: E/StrictMode(653): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d2e680 that was originally bound here
06-06 12:32:04.063: E/StrictMode(653):  at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
06-06 12:32:04.063: E/StrictMode(653):  at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
06-06 12:32:04.063: E/StrictMode(653):  at android.app.ContextImpl.bindService(ContextImpl.java:1418)
06-06 12:32:04.063: E/StrictMode(653):  at android.app.ContextImpl.bindService(ContextImpl.java:1407)
06-06 12:32:04.063: E/StrictMode(653):  at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
06-06 12:32:04.063: E/StrictMode(653):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
06-06 12:32:04.063: E/StrictMode(653):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
06-06 12:32:04.063: E/StrictMode(653):  at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191)
06-06 12:32:04.063: E/StrictMode(653):  at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850)
06-06 12:32:04.063: E/StrictMode(653):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
06-06 12:32:04.063: E/StrictMode(653):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
06-06 12:32:04.063: E/StrictMode(653):  at android.os.AsyncTask$2.call(AsyncTask.java:287)
06-06 12:32:04.063: E/StrictMode(653):  at java.util.concurrent.FutureTask.run(FutureTask.java:234)
06-06 12:32:04.063: E/StrictMode(653):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
06-06 12:32:04.063: E/StrictMode(653):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
06-06 12:32:04.063: E/StrictMode(653):  at java.lang.Thread.run(Thread.java:856)
06-06 12:32:53.943: E/ActivityThread(653): Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40cef940 that was originally bound here
06-06 12:32:53.943: E/ActivityThread(653): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40cef940 that was originally bound here
06-06 12:32:53.943: E/ActivityThread(653):  at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
06-06 12:32:53.943: E/ActivityThread(653):  at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
06-06 12:32:53.943: E/ActivityThread(653):  at android.app.ContextImpl.bindService(ContextImpl.java:1418)
06-06 12:32:53.943: E/ActivityThread(653):  at android.app.ContextImpl.bindService(ContextImpl.java:1407)
06-06 12:32:53.943: E/ActivityThread(653):  at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
06-06 12:32:53.943: E/ActivityThread(653):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
06-06 12:32:53.943: E/ActivityThread(653):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
06-06 12:32:53.943: E/ActivityThread(653):  at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191)
06-06 12:32:53.943: E/ActivityThread(653):  at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850)
06-06 12:32:53.943: E/ActivityThread(653):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
06-06 12:32:53.943: E/ActivityThread(653):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
06-06 12:32:53.943: E/ActivityThread(653):  at android.os.AsyncTask$2.call(AsyncTask.java:287)
06-06 12:32:53.943: E/ActivityThread(653):  at java.util.concurrent.FutureTask.run(FutureTask.java:234)
06-06 12:32:53.943: E/ActivityThread(653):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
06-06 12:32:53.943: E/ActivityThread(653):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
06-06 12:32:53.943: E/ActivityThread(653):  at java.lang.Thread.run(Thread.java:856)
06-06 12:32:53.963: E/StrictMode(653): null
06-06 12:32:53.963: E/StrictMode(653): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40cef940 that was originally bound here
06-06 12:32:53.963: E/StrictMode(653):  at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
06-06 12:32:53.963: E/StrictMode(653):  at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
06-06 12:32:53.963: E/StrictMode(653):  at android.app.ContextImpl.bindService(ContextImpl.java:1418)
06-06 12:32:53.963: E/StrictMode(653):  at android.app.ContextImpl.bindService(ContextImpl.java:1407)
06-06 12:32:53.963: E/StrictMode(653):  at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
06-06 12:32:53.963: E/StrictMode(653):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
06-06 12:32:53.963: E/StrictMode(653):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
06-06 12:32:53.963: E/StrictMode(653):  at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191)
06-06 12:32:53.963: E/StrictMode(653):  at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850)
06-06 12:32:53.963: E/StrictMode(653):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
06-06 12:32:53.963: E/StrictMode(653):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
06-06 12:32:53.963: E/StrictMode(653):  at android.os.AsyncTask$2.call(AsyncTask.java:287)
06-06 12:32:53.963: E/StrictMode(653):  at java.util.concurrent.FutureTask.run(FutureTask.java:234)
06-06 12:32:53.963: E/StrictMode(653):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
06-06 12:32:53.963: E/StrictMode(653):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
06-06 12:32:53.963: E/StrictMode(653):  at java.lang.Thread.run(Thread.java:856)
4

1 に答える 1

1

エミュレータで Exchange サービスを無効にすると、このエラーが解決されました:([設定] -> [アプリ] -> [すべて] -> [Exchange サービス] -> [無効] を使用)

android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d085b0 that was originally bound here

Android 4.2.2 を使用しているため、アクティブなネットワーク操作には AsyncTask を使用する必要があります。このコードは私のために働いた:

public void MyActivity extends Activity{

public void onCreate(Bundle savedInstanceState){

     new  MyAsyncTaskClass().execute();
}

//internal class
public class MyAsyncTaskClass extends AsyncTask<Void, Void, Void>{

    @Override
    protected Void doInBackground(Void... arg0) {
            Properties properties = new Properties();
        properties.setProperty("mail.imaps.host", "imap.gmail.com"); 
            properties.setProperty("mail.imaps.auth", "true"); 
            properties.setProperty("mail.imaps.debug", "true"); 
            properties.setProperty("mail.imaps.port", "993");
            properties.setProperty("mail.store.protocol", "imaps");
        session = Session.getInstance(properties);

            store = session.getStore("imaps");
            store.connect("imap.gmail.com", 993, userName, password);
            return null;
      }

    }
}
于 2013-06-08T20:22:47.950 に答える