1

I am tryig to dexify a jar file using the following command:

dx --dex --output=classes.dex JAR_file.jar

This gives me the following errors:

    trouble processing:
    bad class file magic (cafebabe) or version (0033.0000)
    .....................etc

When I searched, I found that they are the same errors that appear in this question

Yes, I was compiling my project with JDK 1.7. So I downloaded JDK 1.6, and changed the setting of my eclipse to make it use JDK 1.6.

I did that by: Window->Preferences->Compiler and then I set the compiler compilance level to 1.6. Finally, I configured the compiler to make it use JRE6 that I downloaded. I clicked OK. I tried to run my project again, and generated the jar file.

When I run the command again for dexifying that jar file. It still shows the same errors. What am I missing?

Note: The jar file is a bundle that I created in my eclipse as a "Plugin" project. Here is a snapshot of the project:

enter image description here

In the question I am referring to, the accepted answer says if you still have the same problem, then you have to make sure that every single class is compiled right. What does that mean? I tried to compile again and again, but I am still getting the same errors.

Community
  • 1
  • 1
Traveling Salesman
  • 2,209
  • 11
  • 46
  • 83

2 Answers2

0

If you look in Proguard.bat (Android SDK\tools\proguard\bin), you will find the following line:

call %java_exe% -jar "%PROGUARD_HOME%"\lib\proguard.jar %*

Replace it with the following:

call %java_exe% -jar "%PROGUARD_HOME%"\lib\proguard.jar %1 %2 %3 %4 %5 %6 %7 %8 %9

Mentioned here

Community
  • 1
  • 1
Adam Johns
  • 35,397
  • 25
  • 123
  • 176
  • Here's what I have in my Proguard.bat. It is not exactly the same as you mentioned. I feel it's critical file, so I want the exact match and the exact replacement. @ECHO OFF REM Start-up script for ProGuard -- free class file shrinker, optimizer, REM obfuscator, and preverifier for Java bytecode. REM REM Note: when passing file names containing spaces to this script, REM you'll have to add escaped quotes around them, e.g. REM "\"C:/My Directory/My File.txt\"" IF EXIST "%PROGUARD_HOME%" GOTO home SET PROGUARD_HOME=.. :home java -jar "%PROGUARD_HOME%"\lib\proguard.jar %* – Traveling Salesman Jul 31 '13 at 18:24
  • I replaced : -jar "%PROGUARD_HOME%"\lib\proguard.jar %* by: -jar "%PROGUARD_HOME%"\lib\proguard.jar %1 %2 %3 %4 %5 %6 %7 %8 %9 but when I wrote the command again, it showed the same error. – Traveling Salesman Jul 31 '13 at 18:36
  • I'll keep looking and see if I can find anything else. – Adam Johns Jul 31 '13 at 18:38
  • Do you have any frameworks in your project with sdk level set at 1.7? http://stackoverflow.com/questions/8748977/android-emulator-crash-dx-bad-class-file-magic-classnotfoundexception-on-st – Adam Johns Jul 31 '13 at 18:46
  • Possibly. I am not sure though. And I don't know how I can check if I have such frameworks or not. So I am looking for a quick fix for everything. But I do have a good feeling that not all the classes are compiled with JDK 6. By the way, you can see in the picture I attached that I am using one library compiled by 1.7. I updated this one to 1.6. But still, it didn't work. i will try more. Thanks for your help. Let me know if you figured anything out. – Traveling Salesman Jul 31 '13 at 18:53
  • I created a totally new project, converted to jar, dexified it. It worked! – Traveling Salesman Jul 31 '13 at 19:23
0

I created a totally new project (after changing my eclipse compiler to JDK 1.6). Then, the dexifying worked OK.

Traveling Salesman
  • 2,209
  • 11
  • 46
  • 83