混淆(proguard)会导致 MIDlet 故障吗?

发布于 2024-09-03 01:31:14 字数 778 浏览 1 评论 0原文

我试图用 proguard 来混淆 Java MIDlet。它在 PC 上运行正常,但是,当我在手机上运行它时,程序打开,连接到服务器,然后冻结。如果我禁用混淆,它会在手机上再次正常运行。我已经尝试了应用程序的所有混淆级别(NetBeans 的 7、8 和 9),但它们似乎都无法正常工作,而且我无法在不进行混淆的情况下发布此应用程序用于商业用途。另外,编译器会抛出一些警告:

Note: duplicate definition of library class [java.io.ByteArrayOutputStream]
Note: there were 14 duplicate class definitions.

但我不知道这是否真的是问题所在。有谁知道出了什么问题吗?下面列出了混淆器参数:

Obfuscator Arguments (7):
    -dontusemixedcaseclassnames
    -default package ''
    -keep public class ** {
        public *;
    }

Obfuscator Arguments (8): same as (7) plus -overloadaggressively.

Obfuscator Arguments (9): same as (8) but
    -keep public class ** extends javax.microedition.midlet.MIDlet {
        public *;
    }
instead.

谢谢。

Im trying to obfuscate a Java MIDlet with proguard. It runs ok on the PC, however, when I run it on the phone, the program opens, connects to the server, and then freezes. If I disable obfuscation, it runs ok again on the phone. Ive tryed all the obfuscation levels for apps (7, 8 and 9 at NetBeans), and none of them seems to work properly, and I cant release this app for comercial use without obfuscation. Also, the compiler throws some warnings:

Note: duplicate definition of library class [java.io.ByteArrayOutputStream]
Note: there were 14 duplicate class definitions.

But I dont know if this is realy the problem. Does anyone knows what is wrong? The obfuscator arguments are listed below:

Obfuscator Arguments (7):
    -dontusemixedcaseclassnames
    -default package ''
    -keep public class ** {
        public *;
    }

Obfuscator Arguments (8): same as (7) plus -overloadaggressively.

Obfuscator Arguments (9): same as (8) but
    -keep public class ** extends javax.microedition.midlet.MIDlet {
        public *;
    }
instead.

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

紫轩蝶泪 2024-09-10 01:31:14

混淆可能会破坏东西。如果没有固定的示例代码,很难准确地说出可能出了什么问题。一个可能出错的例子是,如果您按名称加载代码中的类 - 混淆的类将具有不同的名称,因此不会被发现。

您提到的消息可能表明了问题 - 您必须拥有这些课程在你的道路上不止一次。
您提到的那个课程与您遇到问题的连接相关吗?仔细查看正在使用的 jar 并确保您的应用程序中包含正确(且最少)的类集。 CLDC 中的 ByteArrayOutputStream 不一样与桌面 JDK 中一样。

Obfuscation can break stuff. Without potted example code it's hard to say exactly what might be wrong. An example of something that could go wrong is if you load a class in your code by name - the obfuscated class will have a different name, and hence will not be found.

The messages you mention could be indicative of the problem - you must have those classes more than once on your path.
Is that class you mention pertinent to the connection you're having problems with? Look closely at the jars in use and ensure the the right (and minimum) set of classes are being included in your application. ByteArrayOutputStream in the CLDC is not the same as in the desktop JDK.

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