android:proguard混淆问题
我使用适用于 Android 的 javamail api 制作了一个邮件客户端,并且该应用程序在模拟器或设备中运行良好...现在我想使用 eclipse 导出该项目,但出现以下错误:
Warning: org.apache.harmony.awt.datatransfer.DataProxy: can't find superclass or interface java.awt.datatransfer.Transferable
Warning: org.apache.harmony.awt.datatransfer.NativeClipboard: can't find superclass or interface java.awt.datatransfer.Clipboard
Warning: javax.activation.CommandInfo: can't find referenced class java.beans.Beans
Warning: com.sun.mail.imap.protocol.IMAPSaslAuthenticator: can't find referenced class javax.security.sasl.Sasl
Warning: com.sun.mail.imap.protocol.IMAPSaslAuthenticator: can't find referenced class javax.security.sasl.SaslClient
Warning: com.sun.mail.imap.protocol.IMAPSaslAuthenticator: can't find referenced class javax.security.sasl.SaslException
Warning: org.apache.harmony.awt.datatransfer.DragSourceEventProxy: can't find referenced class java.awt.Point
Warning: org.apache.harmony.awt.datatransfer.DragSourceEventProxy: can't find referenced class java.awt.dnd.DragSourceContext
Warning: org.apache.harmony.awt.datatransfer.DragSourceEventProxy: can't find referenced class java.awt.dnd.DragSourceEvent
正如我所看到的 javamail api 使用 java .awt 和 javax.security 库...我如何将它们添加到我的项目中,以便我可以导出我的项目并对其进行混淆?
非常感谢!
更新:
我尝试在我的项目中导入 jre 库,这些错误消失了,但出现了新的错误:
Proguard returned with error code 1. See console
Note: there were 4243 duplicate class definitions.
Warning: library class com.sun.xml.internal.messaging.saaj.soap.FastInfosetDataContentHandler extends or implements program class javax.activation.DataContentHandler
Warning: library class com.sun.xml.internal.ws.encoding.XmlDataContentHandler extends or implements program class javax.activation.DataContentHandler
Warning: library class com.sun.xml.internal.messaging.saaj.soap.MessageImpl$1 extends or implements program class javax.activation.DataSource
Warning: library class com.sun.xml.internal.ws.encoding.StringDataContentHandler extends or implements program class javax.activation.DataContentHandler
我能做什么?
I made a mail client with the use of javamail api for android and the app runs well in emulator or device... Now I want to export the project using eclipse but I got the following errors:
Warning: org.apache.harmony.awt.datatransfer.DataProxy: can't find superclass or interface java.awt.datatransfer.Transferable
Warning: org.apache.harmony.awt.datatransfer.NativeClipboard: can't find superclass or interface java.awt.datatransfer.Clipboard
Warning: javax.activation.CommandInfo: can't find referenced class java.beans.Beans
Warning: com.sun.mail.imap.protocol.IMAPSaslAuthenticator: can't find referenced class javax.security.sasl.Sasl
Warning: com.sun.mail.imap.protocol.IMAPSaslAuthenticator: can't find referenced class javax.security.sasl.SaslClient
Warning: com.sun.mail.imap.protocol.IMAPSaslAuthenticator: can't find referenced class javax.security.sasl.SaslException
Warning: org.apache.harmony.awt.datatransfer.DragSourceEventProxy: can't find referenced class java.awt.Point
Warning: org.apache.harmony.awt.datatransfer.DragSourceEventProxy: can't find referenced class java.awt.dnd.DragSourceContext
Warning: org.apache.harmony.awt.datatransfer.DragSourceEventProxy: can't find referenced class java.awt.dnd.DragSourceEvent
As I can see the javamail api uses java.awt and javax.security libs... how can I add them in my project so I can export my project and obfuscate it?
Thank you very much!
UPDATE:
I tried to import the jre library in my project and those errors are gone but new ones apeared:
Proguard returned with error code 1. See console
Note: there were 4243 duplicate class definitions.
Warning: library class com.sun.xml.internal.messaging.saaj.soap.FastInfosetDataContentHandler extends or implements program class javax.activation.DataContentHandler
Warning: library class com.sun.xml.internal.ws.encoding.XmlDataContentHandler extends or implements program class javax.activation.DataContentHandler
Warning: library class com.sun.xml.internal.messaging.saaj.soap.MessageImpl$1 extends or implements program class javax.activation.DataSource
Warning: library class com.sun.xml.internal.ws.encoding.StringDataContentHandler extends or implements program class javax.activation.DataContentHandler
What can I do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
列出的 java 类不是 Android 运行时的一部分。最干净的解决方案是从 javamail 库中删除引用它们的类,因为它们永远无法在这种环境中工作。
一般来说,您也可以在 ProGuard 配置中过滤掉它们,但 Android 构建脚本不支持过滤器。
作为一个简单的替代方案,您可以抑制警告:
然后 ProGuard 将继续执行而不会抱怨。
The listed java classes are not part of the Android runtime. The cleanest solution would be to remove the classes that reference them from the javamail library, because they can never work in this environment.
In general, you could also filter them out in your ProGuard configuration, but the Android build script doesn't support filters.
As a simple alternative, you can suppress the warnings:
ProGuard will then proceed without complaining.
我通过在项目中添加 jre 库并将此命令添加到 proguard.cfg 文件中解决了问题:
希望这对某人有帮助:P
I have solved the problem by adding the jre library in the project and ten adding this comand to proguard.cfg file:
hope this help somebody :P