混淆时遇到麻烦
我正在使用 Antenna 来构建、打包和混淆 j2me 应用程序。 构建和包装工作正常。
该项目使用了第 3 方 jar,除了某些接口之外,该 jar 已经被混淆了。
当尝试混淆时,我遇到了几个错误,例如:
[wtkobfuscate] Warning: i: can't find referenced class fooPackage.fooClass
Class i 和 fooPackage.fooClass 来自我提到的第 3 方 jar。
更新:
此第 3 方库使用 j2me-xmlrpc.jar。 如果我不将所有内容打包在一起,那么我将无法混淆第 3 方接口和 j2me-xmlrpc.jar。 (而且我无法以这种方式运行应用程序,不知道为什么)
如果我只打包 j2me-xmlrpc.jar 和我的项目类,我会在混淆
[wtkobfuscate] Warning: there were 2 instances of library classes depending on program classes.
UPDATE 2:
时收到此错误:我知道这一点混淆是可能的,因为在 Netbeans 中我可以使用 Proguard 进行混淆。
由于 Netbeans 内部使用 ANT 进行构建,因此我尝试将生成的 build.xml 复制到我自己的 build.xml 中。
为了进行混淆,Netbeans 使用可在 Netbeans 外部使用的库 org-netbeans-modules-mobility-antext.jar。 我将此库导入到我的项目中并使用它没有问题。
但我得到了与使用天线相同的错误。
在 Netbeans 中进行混淆会生成大量警告,但仍然会生成混淆的 jar。
我缺少什么?
I'm using Antenna to build, pack and obfuscate a j2me app.
Building and packing works fine.
The project uses a 3rd party jar that is already obfuscated except by some interfaces.
When trying to obfuscate I got several errors like:
[wtkobfuscate] Warning: i: can't find referenced class fooPackage.fooClass
Class i and fooPackage.fooClass is from this 3rd party jar that I mentioned.
UPDATE:
This 3rd party library uses j2me-xmlrpc.jar. If I don't package all together then I won't be able to obfuscate the 3rd party interfaces and the j2me-xmlrpc.jar. (and I can't run the app this way, not sure why)
If I package only the j2me-xmlrpc.jar and my project classes I get the this error while obfuscating
[wtkobfuscate] Warning: there were 2 instances of library classes depending on program classes.
UPDATE 2:
I know this obfuscation is possible beacause in Netbeans I can do obfuscation using Proguard.
Since Netbeans internals uses ANT to make builds I tried to copy the generated build.xml to my own build.xml.
For obfuscation Netbeans uses the library org-netbeans-modules-mobility-antext.jar that can be used outside Netbeans. I imported this library to my project and used it without problem.
But I get the same error I got using antenna.
Obfuscating in Netbeans generates a lot of warnings but it still generates the obfuscated jar.
What I'm missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试使用 jshrink。 我用它得到的结果比用 proguard 好得多:
try using jshrink. I have much better results with it then with proguard:
如果第 3 方库被混淆,则在混淆类时不要包含该库。 相反,请按照以下步骤
If the 3rd party library is obfuscated, don't include that library while you obfuscate your classes. Rather follow these steps
我使用的是 Proguard 4.3。 降级到 Proguard 4.2 解决了这个问题。
I was using Proguard 4.3. Downgrading to Proguard 4.2 solved the problem.