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

前端 未结 18 1871
攒了一身酷
攒了一身酷 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:54

    This error occurs when you use a .jar file that is not using any feature of Java 6 or higher but was built using Java 6 or higher, according to informIT.com. Apparently, Google doesn't include JDK 7 in Android's system requirements.

    So the solution, that worked for me is very simple. Build the .jar file using Java 5 or less.

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

    For the benefit of anyone who may have the same problem:

    Removing proguard allowed the export of the apk to work. Why Proguard works in Linux but not on Windows remains a mystery, however.

    The issue has now been reported on the Android project here: http://code.google.com/p/android/issues/detail?id=21170&can=4&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars

    If you encounter the same problem, please star it.

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

    If you are using Android Studio, this can be fixed by using the above advice to target Java 1.6 in your build.gradle by adding the following lines:

    apply plugin: 'java'
    sourceCompatibility = 1.6
    targetCompatibility = 1.6
    

    Discovered this fix from this blog post: http://www.alonsoruibal.com/my-gradle-tips-and-tricks/

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

    I was having same error message dexing did not work "Dx bad class file magic (cafebabe) or version (0033.0000)".

    I had JDK1.7, Eclipse Kepler, AndroidSDK-19 (Android 4.4) installed. Finally run android-sdk-windows/SDK Manager.exe tool if there is any updates. Turns out I had level 19 sdk but Tools/Android SDK Build-tools part was 18.1.1. Installed Build-tools 19.0.3 and compilation started working fine.

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

    I found the solution to this problem at last.

    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
    

    It's a stupid old issue, that I actually realize that I have seen before, now that I have figured it out. Apparently the Android SDK team still haven't fixed this problem, and it was reintroduced when I did a clean install of the Android SDK.

    0 讨论(0)
  • 2020-11-27 06:01

    I solved this problem in Eclipse by going to Windows --> Preferences Java --> Compiler in the right side window choose Compiler compliance level to 1.6, click Apply and Ok.

    And Clean Build all projects that should solve the problem

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