Dx bad class file magic (cafebabe) or version (0033.0000) with ADK14

前端 未结 18 1882
攒了一身酷
攒了一身酷 2020-11-27 05:00

Since moving to ADK14, I have been unable to build new apks for release on my Windows 7 system.

Building fails with \"conversion to dalvik format failed with error 1

相关标签:
18条回答
  • 2020-11-27 05:36

    Changing the Eclipse java version to 6 worked for me. In Eclipse, go to Windows->Preferences->Java->Compiler and set "Compiler compliance level" to 1.6.

    Strange thing is that I had Eclipse 3.7.0 and it worked fine, while other computers had 3.7.1 and the jar files built there didn't work...

    0 讨论(0)
  • 2020-11-27 05:36

    I've faced this error message during jar -> dex conversion. The problem was in a corrupted jar file.

    0 讨论(0)
  • 2020-11-27 05:38

    Upon reading the source of the dex tool, the problem here is that the class file is not within a version that it can understand. The version must be between 45-50 (major version) The version you're using here is 0033.0000 (0x33 in hex), which is 51 in decimal (the version number representing Java 7). This is not speculation on my part, I found this directly in the source code.

    Following is speculation, and what solved my problem: I haven't figured out what you have to do to solidly confirm what class file version you'll get upon compiling with various options, but for me the problem was that my library had been compiled with Java 7. Since Android only supports Java 5 or 6, I simply recompiled in 6, and boom, solved.

    0 讨论(0)
  • 2020-11-27 05:39

    I fixed this problem by Right click Java Project->Build Path->Configure Build Path Go to Libraries Tab, Select JavaSE-1.7->press Edit then change to JavaSE-1.6 Press finish then ok.

    Go to Android Project, right click Project->Build Path->Configure Build Path Go to Order and Export Tab, check box beside your java project and other libraries you included. Click ok. In your Android Project, delete "gen" and "bin". then shortly after those two folders will regenerate.(If it doesn't then make sure you have ran your eclipse as administrator.)

    now try running android project on your phone. Wala it works :)

    0 讨论(0)
  • 2020-11-27 05:41

    i tried everything from the several other solutions. that thing that helped me was to download the most current version of ProGuard and copy it do android-sdk/tools/proguard/bin and lib.

    0 讨论(0)
  • 2020-11-27 05:43

    Compiling with Java 6 instead of 7 worked for me, but only after I configured Eclipse to "know about" my JRE6 install path. Previously I only had the JRE7 set up in Eclipse. I could set my compiler compliance level to 1.6 or 1.5 but apparently without the corresponding JRE it didn't really have any effect. I don't really understand why that should be--what does the JRE have to do with compiling, and what does it have to do with Android code?

    0 讨论(0)
提交回复
热议问题