本文介绍了执行失败的任务:“:应用程序:preDexDebug”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到著名的:应用程序:preDexDebug'误差

I am experiencing that famous ':app:preDexDebug'-error.

首先:清洁项目或重建它的工作原理没有错误。
在默认设置下我在项目结构工程字节code版本设置为1.7,并在SDK位置的JDK位置似乎是正确的,太。
一个虽然研究后,我依然没有找到这个问题的解决方案。

First of all: Cleaning the project or rebuilding it works without errors.Under default settings I set the project bytecode version to 1.7 and under SDK Location in the project structure the JDK location seems to be correct, too.After a while of researching I still did not find the solution for this problem.

当我试图运行Android的下Studio中的项目出现错误。就像前面提到的,打扫卫生,重建和摇篮同步正常工作(看起来像它 - 没有错误)。

The error occurs when I try to run the project under Android Studio. Like mentioned before, cleaning, rebuilding and syncing with Gradle works fine (looks like it - no errors).

这是什么gradle这个控制台显示:

This is what the gradle console shows:

Configuration on demand is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:checkDebugManifest
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:compileDebugJava UP-TO-DATE
:app:preDexDebug
AGPBI: {"kind":"SIMPLE","text":"UNEXPECTED TOP-LEVEL EXCEPTION:","position":{},"original":"UNEXPECTED TOP-LEVEL EXCEPTION:"}
AGPBI: {"kind":"SIMPLE","text":"com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)","position":{},"original":"com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)"}
AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472)","position":{},"original":"\tat com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472)"}
AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)","position":{},"original":"\tat com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)"}
AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)","position":{},"original":"\tat com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)"}
AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)","position":{},"original":"\tat com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)"}
AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.command.dexer.Main.processClass(Main.java:704)","position":{},"original":"\tat com.android.dx.command.dexer.Main.processClass(Main.java:704)"}
AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.command.dexer.Main.processFileBytes(Main.java:673)","position":{},"original":"\tat com.android.dx.command.dexer.Main.processFileBytes(Main.java:673)"}
AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.command.dexer.Main.access$300(Main.java:83)","position":{},"original":"\tat com.android.dx.command.dexer.Main.access$300(Main.java:83)"}
AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)","position":{},"original":"\tat com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)"}
AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)","position":{},"original":"\tat com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)"}
AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)","position":{},"original":"\tat com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)"}
AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)","position":{},"original":"\tat com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)"}
AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.command.dexer.Main.processOne(Main.java:632)","position":{},"original":"\tat com.android.dx.command.dexer.Main.processOne(Main.java:632)"}
AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.command.dexer.Main.processAllFiles(Main.java:510)","position":{},"original":"\tat com.android.dx.command.dexer.Main.processAllFiles(Main.java:510)"}
AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.command.dexer.Main.runMonoDex(Main.java:280)","position":{},"original":"\tat com.android.dx.command.dexer.Main.runMonoDex(Main.java:280)"}
AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.command.dexer.Main.run(Main.java:246)","position":{},"original":"\tat com.android.dx.command.dexer.Main.run(Main.java:246)"}
AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.command.dexer.Main.main(Main.java:215)","position":{},"original":"\tat com.android.dx.command.dexer.Main.main(Main.java:215)"}
AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.command.Main.main(Main.java:106)","position":{},"original":"\tat com.android.dx.command.Main.main(Main.java:106)"}
AGPBI: {"kind":"SIMPLE","text":"...while parsing impl/org/controlsfx/ImplUtils.class","position":{},"original":"...while parsing impl/org/controlsfx/ImplUtils.class"}
AGPBI: {"kind":"SIMPLE","text":"1 error; aborting","position":{},"original":"1 error; aborting"}


 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:preDexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_67\bin\java.exe'' finished with non-zero exit value 1

正如你看到下面,我删除了编译机器人...... - 在我的build.gradle线,但它仍然没有奏效。
因此,这里是我的gradle这个构建文件:

As you see below, I removed the "compile android. ..."-line in my build.gradle, but it still didn't work.So here is my gradle build file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion '22.0.1'
    compileOptions.encoding = 'windows-1251'

    defaultConfig {
        applicationId "de.giessen.advenco.key2operate"
        minSdkVersion 15
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

它看起来像摇篮有一些问题,我的JDK,但我不知道是什么样的,以及如何解决这些问题。我希望你们能有所帮助。

It looks like Gradle has some problems with my JDK, but I don't know what kind of and how to fix them. I hope you guys can help.

编辑:我发现,那版本(0034.0000)意味着,我使用Java 8奇怪的是,我绝对不使用Java 8。在Android Studio中我定义的JDK路径为C:\\ Program Files文件\\的Java \\ jdk1.7.0_67。这是64位Java(我使用Win 7的64位BTW)。再说,我已经32位Java在C:\\ Program Files文件(x86)的\\的Java \\ jdk1.7.0_75,但我不指着从它的位置Android的工作室(我需要我的机器上两个版本)。有谁知道,为什么Android的工作室认为,我有Java的8我的机器上?正如你可以在我的gradle构建文件中看到,我设置了 sourceCompatibility targetCompatibility JavaVersion.VERSION_1_7 。是否有任何隐藏设置Android Studio中的某处,它定义了Java 8设置?

I found out, that version (0034.0000) means, that I am using Java 8. The strange thing is, that I definitely do not use Java 8. In Android Studio I defined the JDK-path to "C:\Program Files\Java\jdk1.7.0_67". This is 64-Bit Java (I am using Win 7 64-Bit btw.). Besides of that I have 32-Bit Java at "C:\Program Files (x86)\Java\jdk1.7.0_75", but I am not pointing on its location from Android Studio (I need both versions on my machine). Does anyone know, why Android Studio thinks, that I have Java 8 on my machine? As you can see in my gradle build file, I set the sourceCompatibility and the targetCompatibility to JavaVersion.VERSION_1_7. Are there any hidden settings somewhere in Android Studio, which define the Java 8 setting?

推荐答案

解决了这个问题。

什么我弄糊涂了:输出 com.android.dx.cf.iface.ParseException:糟糕的类文件魔术(cafebabe)或版本(0034.0000),位置:{},原:com.android.dx.cf.iface.ParseException:糟糕的类文件魔术(cafebabe)或版本(0034.0000)让我想到,该错误出现了一些Android的库,因为每一个JDK-设置被设定为1.7。

What confused me: The output com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)","position":{},"original":"com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)" let me think, that the error comes out of some android libraries, because every JDK-setting was set to 1.7.

但我知道在某个地方的Java 8中使用。这真是奇怪,我。

But I knew that somewhere Java 8 was used. It was really strange to me.

解决方案:即使使用--stacktrace或--debug的permament通知结果显示,我不知道在哪里使用它们(这是没有在任何地方解释)。搜索设置后,我偶然发现了文本框为这个选项。所以,我在里面写了--debug。此选项给了我有关的信息,究竟是什么造成的错误。由于调试模式被赋予了图书馆的称号,它通过使用Java 8.由于Eclipse并不抱怨导致错误,没有人在我公司注意到这一照顾。是什么让我想到的回报,这一切都必须是正确的。

Solution: Even though the permament notify of using --stacktrace or --debug was shown, I did not know where to use them (it was not explained anywhere). After searching the settings I stumbled upon the textfield for this options. So I wrote "--debug" in it. This option gave me information about, what really causes the error. Thanks to the debug-mode the title of the library was given, which caused the error by using Java 8. Since Eclipse doesn't complain about that, nobody in my company took care of this. What let me think in return, that everything had to be correct.

为了使事情简而言之:如果您遇到错误,许多人一样过,但他们的解决方案不工作或你的情况似乎是非常特别的,只是用--debug。真正的信息是隐藏在那里。

To make things short: If you are experiencing errors, like many people before, but their solutions don't work or your case seems to be very special, just use "--debug". The true informations are hidden there.

这篇关于执行失败的任务:“:应用程序:preDexDebug”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 17:46