-2

我按照说明链接发送邮件。我添加了 Internet 使用权限和发送电子邮件呼叫的方法AsyncTask。但我仍然无法发送电子邮件。我总是在行中收到广告错误Transport.send(message);

这是我的打印堆栈:06-04 14:49:32.203: W/System.err(32750): java.lang.SecurityException: Permission denied (missing INTERNET permission?) 06-04 14:49:32.203: W/System.err(32750): at java.net.InetAddress.lookupHostByName(InetAddress.java:428) 06-04 14:49:32.203: W/System.err(32750): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:239) 06-04 14:49:32.203: W/System.err(32750): at java.net.InetAddress.getByName(InetAddress.java:292) 06-04 14:49:32.203: W/System.err(32750): at javax.mail.URLName.getHostAddress(URLName.java:487) 06-04 14:49:32.203: W/System.err(32750): at javax.mail.URLName.hashCode(URLName.java:463) 06-04 14:49:32.203: W/System.err(32750): at java.util.Hashtable.get(Hashtable.java:263) 06-04 14:49:32.203: W/System.err(32750): at javax.mail.Session.getPasswordAuthentication(Session.java:823) 06-04 14:49:32.203: W/System.err(32750): at javax.mail.Service.connect(Service.java:271) 06-04 14:49:32.213: W/System.err(32750): at javax.mail.Service.connect(Service.java:169) 06-04 14:49:32.213: W/System.err(32750): at javax.mail.Service.connect(Service.java:118) 06-04 14:49:32.213: W/System.err(32750): at javax.mail.Transport.send0(Transport.java:188) 06-04 14:49:32.213: W/System.err(32750): at javax.mail.Transport.send(Transport.java:118) 06-04 14:49:32.213: W/System.err(32750): at com.vakoms.infouser.utils.GmailSender.sendMail(GmailSender.java:66) 06-04 14:49:32.213: W/System.err(32750): at com.vakoms.infouser.utils.SendMessageTask.send(SendMessageTask.java:31) 06-04 14:49:32.213: W/System.err(32750): at com.vakoms.infouser.utils.SendMessageTask.doInBackground(SendMessageTask.java:16) 06-04 14:49:32.213: W/System.err(32750): at com.vakoms.infouser.utils.SendMessageTask.doInBackground(SendMessageTask.java:1) 06-04 14:49:32.213: W/System.err(32750): at android.os.AsyncTask$2.call(AsyncTask.java:287) 06-04 14:49:32.213: W/System.err(32750): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305) 06-04 14:49:32.223: W/System.err(32750): at java.util.concurrent.FutureTask.run(FutureTask.java:137) 06-04 14:49:32.223: W/System.err(32750): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) 06-04 14:49:32.223: W/System.err(32750): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) 06-04 14:49:32.223: W/System.err(32750): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) 06-04 14:49:32.223: W/System.err(32750): at java.lang.Thread.run(Thread.java:864) 06-04 14:49:32.223: W/System.err(32750): Caused by: libcore.io.GaiException: getaddrinfo failed: EAI_NODATA (No address associated with hostname) 06-04 14:49:32.223: W/System.err(32750): at libcore.io.Posix.getaddrinfo(Native Method) 06-04 14:49:32.223: W/System.err(32750): at libcore.io.ForwardingOs.getaddrinfo(ForwardingOs.java:55) 06-04 14:49:32.223: W/System.err(32750): at java.net.InetAddress.lookupHostByName(InetAddress.java:415) 06-04 14:49:32.233: W/System.err(32750): ... 22 more 06-04 14:49:32.233: W/System.err(32750): Caused by: libcore.io.ErrnoException: getaddrinfo failed: EACCES (Permission denied) 06-04 14:49:32.233: W/System.err(32750): ... 25 more

4

1 回答 1

1

您的权限名称中有错字。它应该是:

<uses-permission android:name="android.permission.INTERNET"/>

并不是...android.permissoin...

于 2013-06-04T12:36:41.210 回答