开发者

can't jar after encrypting .class files

I have encrypted .class files and would like to jar them so that I could use dexclassloa开发者_开发问答der to load them.While the problem I get is that I use ant (build.xml[dx command]) to jar them ,but it makes error.

[echo] Converting compiled files and external libraries into D:\XXX/classes.dex...
       [apply] trouble processing:
       [apply] bad class file magic (6244b7bf) or version (e2dd.0927)
       [apply] ...while parsing com/XXX/LibraryProvider.class
       [apply] ...while processing com/XXX/LibraryProvider.class
       [apply] 1 warning
       [apply] no classfiles specified  

It seems like .class file is bad after I encrypted them. How can I solve the problem?


How can I solve the problem?

Get rid of the encryption.

First, such encryption is pointless on regular Java, let alone Android.

Second, for Android, your .class files will only ever exist on your development machine. Android APK files do not contain your .class files with JVM bytecode. The APK files will contain Dalvik bytecode; the build tools cross-compile your .class files to Dalvik bytecode. By encrypting those class files, the build tools cannot use them.

You are welcome to use ProGuard to obfuscate your Java bytecode, as that still results in .class files that the build tools will understand. Proguard is integrated into the Android build chain.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜