使用SMTP从Android应用程序发送电子邮件

时间:2014-11-18 05:36:45

标签: java android email smtp

我一直在使用谷歌SMTP工作在android邮件,我运行这个教程代码来运行这个程序,我运行完全相同的程序,但我一直在我的应用程序崩溃。 我一直在模拟器上运行它。

http://javapapers.com/android/android-email-app-with-gmail-smtp-using-javamail/

你能告诉我们这里的问题,我对此有点新意。

logcat的

11-18 00:20:56.252: I/SendMailTask(1285): About to instantiate GMail...
11-18 00:20:56.262: I/dalvikvm(1285): Could not find method javax.mail.Session.getDefaultInstance, referenced from method com.javapapers.android.androidjavamail.GMail.createEmailMessage
11-18 00:20:56.262: W/dalvikvm(1285): VFY: unable to resolve static method 90: Ljavax/mail/Session;.getDefaultInstance (Ljava/util/Properties;Ljavax/mail/Authenticator;)Ljavax/mail/Session;
11-18 00:20:56.262: D/dalvikvm(1285): VFY: replacing opcode 0x71 at 0x0003
11-18 00:20:56.262: I/dalvikvm(1285): Could not find method javax.mail.Session.getTransport, referenced from method com.javapapers.android.androidjavamail.GMail.sendEmail
11-18 00:20:56.262: W/dalvikvm(1285): VFY: unable to resolve virtual method 91: Ljavax/mail/Session;.getTransport (Ljava/lang/String;)Ljavax/mail/Transport;
11-18 00:20:56.262: D/dalvikvm(1285): VFY: replacing opcode 0x6e at 0x0004
11-18 00:20:56.262: D/dalvikvm(1285): DexOpt: unable to opt direct call 0x0061 at 0x0d in Lcom/javapapers/android/androidjavamail/GMail;.createEmailMessage
11-18 00:20:56.262: D/dalvikvm(1285): DexOpt: unable to opt direct call 0x0060 at 0x1a in Lcom/javapapers/android/androidjavamail/GMail;.createEmailMessage
11-18 00:20:56.262: D/dalvikvm(1285): DexOpt: unable to opt direct call 0x005f at 0x66 in Lcom/javapapers/android/androidjavamail/GMail;.createEmailMessage
11-18 00:20:56.262: I/GMail(1285): Mail server properties set.
11-18 00:20:56.412: I/Choreographer(1285): Skipped 87 frames!  The application may be doing too much work on its main thread.
11-18 00:20:56.732: I/Choreographer(1285): Skipped 41 frames!  The application may be doing too much work on its main thread.
11-18 00:20:56.912: I/Choreographer(1285): Skipped 88 frames!  The application may be doing too much work on its main thread.
11-18 00:20:56.992: I/Choreographer(1285): Skipped 32 frames!  The application may be doing too much work on its main thread.
11-18 00:20:57.122: W/dalvikvm(1285): threadid=12: thread exiting with uncaught exception (group=0xb2aa8ba8)
11-18 00:20:57.752: E/AndroidRuntime(1285): FATAL EXCEPTION: AsyncTask #2
11-18 00:20:57.752: E/AndroidRuntime(1285): Process: com.javapapers.android.androidjavamail, PID: 1285
11-18 00:20:57.752: E/AndroidRuntime(1285): java.lang.RuntimeException: An error occured while executing doInBackground()
11-18 00:20:57.752: E/AndroidRuntime(1285):     at android.os.AsyncTask$3.done(AsyncTask.java:300)
11-18 00:20:57.752: E/AndroidRuntime(1285):     at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
11-18 00:20:57.752: E/AndroidRuntime(1285):     at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
11-18 00:20:57.752: E/AndroidRuntime(1285):     at java.util.concurrent.FutureTask.run(FutureTask.java:242)
11-18 00:20:57.752: E/AndroidRuntime(1285):     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
11-18 00:20:57.752: E/AndroidRuntime(1285):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
11-18 00:20:57.752: E/AndroidRuntime(1285):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
11-18 00:20:57.752: E/AndroidRuntime(1285):     at java.lang.Thread.run(Thread.java:841)
11-18 00:20:57.752: E/AndroidRuntime(1285): Caused by: java.lang.NoClassDefFoundError: javax.mail.Session
11-18 00:20:57.752: E/AndroidRuntime(1285):     at com.javapapers.android.androidjavamail.GMail.createEmailMessage(GMail.java:58)
11-18 00:20:57.752: E/AndroidRuntime(1285):     at com.javapapers.android.androidjavamail.SendMailTask.doInBackground(SendMailTask.java:37)
11-18 00:20:57.752: E/AndroidRuntime(1285):     at android.os.AsyncTask$2.call(AsyncTask.java:288)
11-18 00:20:57.752: E/AndroidRuntime(1285):     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
11-18 00:20:57.752: E/AndroidRuntime(1285):     ... 4 more

0 个答案:

没有答案