坏的类文件的魔法或版本 [英] Bad class file magic or version

查看:183
本文介绍了坏的类文件的魔法或版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经知道这个问题已经被问很多时候和答案,但我发现没有一个答案固定我的问题。

I already know that question has been already asked very often and answers, but no one of the answers i found fixed my problem.

这是错误:

Error:Gradle: Execution failed for task ':ffcommunity:preDexDebug'.
 com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    D:\Android SDK\sdk\build-tools\20.0.0\dx.bat --dex --output D:\Users\ReVo\Documents\IntelliJ IDEA\FFCommunity\ffcommunity\build\intermediates\pre-dexed\debug\bananaquery-2ee85432877a057e7414910b8127805535139d5d.jar D:\Users\ReVo\Documents\IntelliJ IDEA\FFCommunity\ffcommunity\libs\bananaquery.jar
Error Code:
    1
Output:
    UNEXPECTED TOP-LEVEL EXCEPTION:
    com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
        at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472)
        at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
        at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
        at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
        at com.android.dx.command.dexer.Main.processClass(Main.java:665)
        at com.android.dx.command.dexer.Main.processFileBytes(Main.java:634)
        at com.android.dx.command.dexer.Main.access$600(Main.java:78)
        at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:572)
        at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
        at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
        at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
        at com.android.dx.command.dexer.Main.processOne(Main.java:596)
        at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498)
        at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264)
        at com.android.dx.command.dexer.Main.run(Main.java:230)
        at com.android.dx.command.dexer.Main.main(Main.java:199)
        at com.android.dx.command.Main.main(Main.java:103)
    ...while parsing com/comuf/revonline/bananaquery/BananaInsert.class
    1 error; aborting

该错误是坏的类文件魔术(cafebabe)或版本(0034.0000)

我建造,并在同一天执行的应用程序没有问题很多次,但现在这个失败,每次与此消息。

I builded and execute the application without problems many times in the same day but now this fails everytime with this message.

项目SDK是 Android的API 19平台和项目水平 1.7

Project SDK is Android API 19 Platform and project level is 1.7.

CompileSDK是 19 和buildToolsVersion是 '20 .0.0

CompileSDK is 19 and buildToolsVersion is '20.0.0'.

编译选项:

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
}

依赖我:

compile files('libs/bananaquery.jar')


该库是建立与SDK Android的API 19平台与项目级别 1.7


The library is build with SDK Android API 19 Platform with project level 1.7.

我的的.jar 文件里面库/ 文件夹。

我用的IntelliJ IDEA 14 preVIEW,它可能是什么原因呢?随着IntelliJ IDEA的13仍然停留在摇篮同步

I use IntelliJ IDEA 14 Preview, it could be the reason? With IntellIJ IDEA 13 it remains stuck at "Gradle sync"

编译的文件可能是无用的,因为我有编译文件树(导演:库,包括:['的* .jar'])

推荐答案

好吧,是我不好。

在项目SDK部分,当你添加一个 Android SDK中您应该提供的Java SDK 和我所有的Android的软件开发工具包使用的的Java 8 作为SDK,因此创建一个类文件,即使项目水平是错误的版本 1.7 (我不知道为什么,我认为这一切都是通过项目级选取)。

In the Project SDK section, when you add an Android SDK you should provide the Java SDK and all my Android SDKs uses Java 8 as SDK so it create the class files with the wrong version even if the Project level is 1.7 (i don't know why, i supposed that everything was choosed by Project level).

现在我改变了SDK(即 Java版本1.x.0部分。)

Now i changed the SDK (the java version "1.x.0" part.)

和它看起来编译罚款。

and it seems to compile fine.

这是工作在今天之前是因为我的SDK是 1.8 ,而不是其原因 Android的API X

The reason that worked before today was because my SDK was 1.8 and not Android API x

这篇关于坏的类文件的魔法或版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆