任务':app:dexDebug'的执行失败.com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException

Wah*_*hib 19 java android docx4j

当我在项目中导入docx4j库后出现此错误时,我正在构建我的android项目.我该怎么做才能摆脱这种异常.

错误:任务':app:dexDebug'的执行失败.> com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:进程'命令'/ usr/lib/jvm/java-7-openjdk-amd64/bin/java''用非结束 - 零退出值2

sou*_*tab 47

将其添加到您的文件构建中.gradle这个

defaultConfig {
     multiDexEnabled true 
}
Run Code Online (Sandbox Code Playgroud)

  • 非常感谢,似乎只有一种方法可以解决这个问题.我问你从哪里找到它?(谷歌翻译) (2认同)

ser*_*ile 9

Android SDK Build Tools 21.1及更高版本中提供的Gradle Android插件支持multidex,因此您必须添加multiDexEnabled true到gradle文件中,如下所示:

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.0"

    defaultConfig {
        ...
        minSdkVersion 14
        targetSdkVersion 21
        ...

        // Enabling multidex support.
        multiDexEnabled true
    }
    ...
}

dependencies {
  compile 'com.android.support:multidex:1.0.0'
}
Run Code Online (Sandbox Code Playgroud)


小智 6

我可能需要更多信息,但根据您的问题的错误:

错误:任务':app:dexDebug'的执行失败.> com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:进程'命令'/ usr/lib/jvm/java-7-openjdk-amd64/bin/java''用非结束 - 零退出值2

IntelliJ编译方式可能会导致您发布的错误(至少在我的情况下,它确实).我最近来自Eclipse,每次运行后都会制作一个"清洁项目".在IntelliJ中,项目需要运行干净的构建.我每次都避免清理,在build.gradle的dexOptions中禁用增量标志.


小智 2

我也遇到了同样的错误。但我通过在依赖项中添加 build.gradle 中缺少的以下行解决了该问题。编译 'com.parse.bolts:bolts-android:1.+'

After adding this line, my dependencies body was like this:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.parse.bolts:bolts-android:1.+'
compile fileTree(dir: 'libs', include: 'Parse-*.jar')
compile fileTree(dir: 'libs', include: "commons-io-2.4.jar")  }
Run Code Online (Sandbox Code Playgroud)

你也可以和你的搭配一下,看看是否也能帮到你