电子邮件程序工作,我不知道为什么

时间:2012-06-22 16:02:12

标签: android android-strictmode

我在网站使用电子邮件程序:Sending emails without User intervention

该程序运行没有问题,并没有崩溃,但是电子邮件没有被发送,我确实得到了我的日志猫的错误列表,我不知道为什么。

我唯一的许可是互联网,我不确定这个项目是否还有其他我需要的人。

任何帮助将不胜感激,谢谢你的时间。

这是log cat:

06-22 15:41:52.216: E/MailApp(675): Could not send email
06-22 15:41:52.216: E/MailApp(675): android.os.NetworkOnMainThreadException
06-22 15:41:52.216: E/MailApp(675):     at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1099)
06-22 15:41:52.216: E/MailApp(675):     at java.net.InetAddress.lookupHostByName(InetAddress.java:391)
06-22 15:41:52.216: E/MailApp(675):     at java.net.InetAddress.getLocalHost(InetAddress.java:371)
06-22 15:41:52.216: E/MailApp(675):     at javax.mail.internet.InternetAddress.getLocalAddress(InternetAddress.java:517)
06-22 15:41:52.216: E/MailApp(675):     at javax.mail.internet.UniqueValue.getUniqueMessageIDValue(UniqueValue.java:99)
06-22 15:41:52.216: E/MailApp(675):     at javax.mail.internet.MimeMessage.updateMessageID(MimeMessage.java:2054)
06-22 15:41:52.216: E/MailApp(675):     at javax.mail.internet.MimeMessage.updateHeaders(MimeMessage.java:2076)
06-22 15:41:52.216: E/MailApp(675):     at javax.mail.internet.MimeMessage.saveChanges(MimeMessage.java:2042)
06-22 15:41:52.216: E/MailApp(675):     at javax.mail.Transport.send(Transport.java:117)
06-22 15:41:52.216: E/MailApp(675):     at com.dummies.android.SuperMailTest3.Mail.send(Mail.java:106)
06-22 15:41:52.216: E/MailApp(675):     at com.dummies.android.SuperMailTest3.SuperMailTest3Activity$1.onClick(SuperMailTest3Activity.java:41)
06-22 15:41:52.216: E/MailApp(675):     at android.view.View.performClick(View.java:3511)
06-22 15:41:52.216: E/MailApp(675):     at android.view.View$PerformClick.run(View.java:14105)
06-22 15:41:52.216: E/MailApp(675):     at android.os.Handler.handleCallback(Handler.java:605)
06-22 15:41:52.216: E/MailApp(675):     at android.os.Handler.dispatchMessage(Handler.java:92)
06-22 15:41:52.216: E/MailApp(675):     at android.os.Looper.loop(Looper.java:137)
06-22 15:41:52.216: E/MailApp(675):     at android.app.ActivityThread.main(ActivityThread.java:4424)
06-22 15:41:52.216: E/MailApp(675):     at java.lang.reflect.Method.invokeNative(Native Method)
06-22 15:41:52.216: E/MailApp(675):     at java.lang.reflect.Method.invoke(Method.java:511)
06-22 15:41:52.216: E/MailApp(675):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
06-22 15:41:52.216: E/MailApp(675):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
06-22 15:41:52.216: E/MailApp(675):     at dalvik.system.NativeStart.main(Native Method)

1 个答案:

答案 0 :(得分:0)

您正在UI线程中建立网络连接,此外您还在设备上启用了严格模式。

在后台线程中建立连接或在开发人员设置中关闭严格模式。第一个是推荐的。