android:proguard混淆问题

发布于 2024-10-24 06:24:04 字数 2114 浏览 6 评论 0原文

我使用适用于 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

俯瞰星空 2024-10-31 06:24:04

列出的 java 类不是 Android 运行时的一部分。最干净的解决方案是从 javamail 库中删除引用它们的类,因为它们永远无法在这种环境中工作。

一般来说,您也可以在 ProGuard 配置中过滤掉它们,但 Android 构建脚本不支持过滤器。

作为一个简单的替代方案,您可以抑制警告:

-dontwarn java.awt.**,javax.security.**,java.beans.**

然后 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:

-dontwarn java.awt.**,javax.security.**,java.beans.**

ProGuard will then proceed without complaining.

dawn曙光 2024-10-31 06:24:04

我通过在项目中添加 jre 库并将此命令添加到 proguard.cfg 文件中解决了问题:

-libraryjars <java.home>/lib/rt.jar(java/**,javax/security/**,javax/activation/**)

希望这对某人有帮助:P

I have solved the problem by adding the jre library in the project and ten adding this comand to proguard.cfg file:

-libraryjars <java.home>/lib/rt.jar(java/**,javax/security/**,javax/activation/**)

hope this help somebody :P

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文