使用javamail API发送电子邮件时,proguard失败

时间:2013-09-06 04:03:32

标签: javamail sendmail proguard

我正在使用javamail API在我的应用中发送电子邮件和httpclient进行网络访问。 我参考了演示gmailsender.Here是链接:Sending Email in Android using JavaMail API without using the default/built-in app

调试时没有错误,我可以在手机中顺利运行APK。但是,当我尝试使用proguard生成我签名的APK时,我发现控制台显示“Proguard返回错误代码1”,虽然我做了作为解决方案Android, javamail and proguard。因此,我无法使用Proguard构建我的APK。

有人可以帮我吗? 控制台显示如下:

Proguard returned with error code 1. See console
[2013-09-06 10:32:25 - ] Note: there were 1487 duplicate class definitions.
[2013-09-06 10:32:25 - ] Warning: library class org.apache.log4j.net.SMTPAppender$1    extends  or implements program class javax.mail.Authenticator
[2013-09-06 10:32:25 - ] Warning: there were 1 instances of library classes depending on program classes.
[2013-09-06 10:32:25 - ]          You must avoid such dependencies, since the program classes will
[2013-09-06 10:32:25 - ]          be processed, while the library classes will remain unchanged.
[2013-09-06 10:32:25 - ]         (http://proguard.sourceforge.net/manual/troubleshooting.html#dependency)
[2013-09-06 10:32:25 - ] java.io.IOException: Please correct the above warnings first.
[2013-09-06 10:32:25 - ]    at proguard.Initializer.execute(Initializer.java:369)
[2013-09-06 10:32:25 - ]    at proguard.ProGuard.initialize(ProGuard.java:212)
[2013-09-06 10:32:25 - ]    at proguard.ProGuard.execute(ProGuard.java:87)
[2013-09-06 10:32:25 - ]    at proguard.ProGuard.main(ProGuard.java:484)

1 个答案:

答案 0 :(得分:0)

有关重复类的说明表明您在dexguard-project.txt文件中指定了-injars选项或-libraryjars选项。您不应该这样做,因为Android构建过程已经为您指定了所有必需的-injars,-outjars和-libraryjars。

如果您随后收到有关缺少课程的警告,您可以让ProGuard忽略它们,例如:

-dontwarn somepackage.SomeMissingClass

(CFR)。 ProGuard手册>疑难解答> Warning: can't find superclass or interface