ProGuard 破坏了 Java 应用程序 - 没有文本,没有图像
我正在尝试使用 ProGuard 来混淆 Java 应用程序。我遇到一个问题,所有文本和图像都从 GUI (Swing) 表单中消失。我尝试过禁用优化并包含更多库,但似乎没有任何效果。
我已经使用反编译器检查了混淆器生成的输出,并且我的资源路径似乎仍然正确。
- 我是否需要在 jre/lib/rt.jar 之外包含更多核心 Java 库?
- 还有更多我应该禁用的设置吗?
- ...其他建议?
谢谢。
I'm trying to use ProGuard to obfuscate a Java application. I'm experiencing a problem where all of my text and images disappear from the GUI (Swing) forms. I've tried disabling optimizations and including more libraries, but nothing seems to be working.
I've inspected the output generated by the obfuscator with a decompiler, and my resource paths seem to still be correct.
- Do I need to be including more core Java libraries outside of jre/lib/rt.jar?
- Are there more settings I should disable?
- ...other suggestions?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的资源很可能是 (a) 通过混淆包含资源的包时 ProGuard 正在更改的路径来访问,或者 (b) 因为它们没有复制到输出 JAR 中而被删除。
您不需要在配置中显式包含 Java 运行时类。
您可能需要查看以下选项:
并参见http://proguard.sourceforge.net/manual/examples.html#resourcefiles< /a> 了解更多详细信息。
Most likely your resources are either (a) being accessed via a path which ProGuard is changing when the package containing the resource is obfuscated, or (b) being dropped because they are not copied to the output JAR.
You should not need to be explicitly including the Java runtime classes in your configuration.
You might want to look at the following options:
And see http://proguard.sourceforge.net/manual/examples.html#resourcefiles for more detail.
不可能。奥托,你什么意思? “jre/lib/rt.jar 核心 Java 库外部”不是矛盾吗?
因为我也遇到过类似的问题。我一开始让 PG 什么都不做,然后允许对我的部分类进行混淆等等,这是对问题的一种二分搜索。最后我找到了罪魁祸首,并且可以混淆几乎所有内容。
确保您不会接受任何异常。尝试使用 Class.getResource 访问图像,以便了解它是否有效。禁用所有内容。
Improbable. OTOH, what do you mean? Isn't "core Java libraries outside of jre/lib/rt.jar" an oxymoron?
As I had a similar problem,. I started with letting PG do nothing at all, then allowed obfuscation of a part of my classes, etc., a sort of binary search for the problem. At the end I found the culprit and could let obfuscate nearly everything.
Make sure you don't swallow any exception. Try to access the images using Class.getResource, so you find out if it works. Disable everything.