我正在自定义 Android 设备上开发 IMAP 客户端。所以我决定使用 Java Mail 库。我需要从 Java Mail 的 1.4.1 版本更新到 1.4.5,因为在巨大的 INBOX 文件夹(大约 120k 邮件)的情况下我有内存问题。
所以我从官方主页下载了 2 个 jars(mail.jar 和 activation.jar),我也尝试了发布候选版本 1.4.6,但我无法让它工作。
一旦我构建了整个应用程序,一切都很好,但是当我运行时,它会出现:
2-05 17:31:21.020 19862 19912 I dalvikvm: Failed resolving Ljavax/activation/DataHandler; interface 571 'Ljava/awt/datatransfer/Transferable;'
12-05 17:31:21.030 19862 19912 W dalvikvm: Link of class 'Ljavax/activation/DataHandler;' failed
12-05 17:31:21.030 19862 19912 W dalvikvm: VFY: unable to find class referenced in signature (Ljavax/activation/DataHandler;)
12-05 17:31:21.030 19862 19912 I dalvikvm: Failed resolving Ljavax/activation/DataHandler; interface 571 'Ljava/awt/datatransfer/Transferable;'
12-05 17:31:21.030 19862 19912 W dalvikvm: Link of class 'Ljavax/activation/DataHandler;' failed
12-05 17:31:21.030 19862 19912 E dalvikvm: Could not find method javax.activation.DataHandler.getName, referenced from method javax.mail.internet.MimeUtility.getEncoding
12-05 17:31:21.030 19862 19912 W dalvikvm: VFY: unable to resolve virtual method 4632: Ljavax/activation/DataHandler;.getName ()Ljava/lang/String;
12-05 17:31:21.040 19862 19912 W dalvikvm: VFY: rejecting opcode 0x6e at 0x0004
12-05 17:31:21.040 19862 19912 W dalvikvm: VFY: rejected Ljavax/mail/internet/MimeUtility;.getEncoding (Ljavax/activation/DataHandler;)Ljava/lang/String;
12-05 17:31:21.040 19862 19912 W dalvikvm: Verifier rejected class Ljavax/mail/internet/MimeUtility;
12-05 17:31:21.050 19862 19912 D EMAIL : Releasing mail download wake lock
12-05 17:31:21.050 19862 19912 W dalvikvm: threadid=17: thread exiting with uncaught exception (group=0x4001aa30)
12-05 17:31:21.060 19862 19912 E AndroidRuntime: Uncaught handler: thread pool-1-thread-1 exiting due to uncaught exception
12-05 17:31:21.080 19862 19912 E AndroidRuntime: java.lang.VerifyError: javax.mail.internet.MimeUtility
12-05 17:31:21.080 19862 19912 E AndroidRuntime: at com.sun.mail.imap.protocol.IMAPProtocol.<init>(IMAPProtocol.java:130)
12-05 17:31:21.080 19862 19912 E AndroidRuntime: at com.sun.mail.imap.IMAPStore.newIMAPProtocol(IMAPStore.java:685)
12-05 17:31:21.080 19862 19912 E AndroidRuntime: at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:636)
12-05 17:31:21.080 19862 19912 E AndroidRuntime: at javax.mail.Service.connect(Service.java:295)
12-05 17:31:21.080 19862 19912 E AndroidRuntime: at javax.mail.Service.connect(Service.java:176)
12-05 17:31:21.080 19862 19912 E AndroidRuntime: at it.kynetics.imwatch.email.imap.EmailAuthenticationImpl.login(EmailAuthenticationImpl.java:36)
12-05 17:31:21.080 19862 19912 E AndroidRuntime: at it.kynetics.imwatch.email.imap.EmailConnection.execute(EmailConnection.java:21)
12-05 17:31:21.080 19862 19912 E AndroidRuntime: at it.kynetics.imwatch.email.ImCloudEmailService$GetEmailTask.run(ImCloudEmailService.java:148)
12-05 17:31:21.080 19862 19912 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:648)
12-05 17:31:21.080 19862 19912 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:673)
12-05 17:31:21.080 19862 19912 E AndroidRuntime: at java.lang.Thread.run(Thread.java:1060)
12-05 17:31:21.120 1830 1830 I Process : Sending signal. PID: 19862 SIG: 3
我尝试检查jar中的DataHandler和getName方法,一切正常。
有没有人有同样的问题?
谢谢大家。