任务 ':app:dexDebug' 执行失败。 com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException
Execution failed for task ':app:dexDebug'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException
我正在构建我的 android 项目时,在我的项目中导入 docx4j 库后出现此错误。我应该怎么做才能摆脱这个异常。
Error:Execution failed for task ':app:dexDebug'. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-7-openjdk-amd64/bin/java'' finished with non-zero exit value 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") }
你也可以搭配一下,看看对你有没有帮助
我可能需要更多信息,但根据你问题的错误:
Error:Execution failed for task ':app:dexDebug'. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-7-openjdk-amd64/bin/java'' finished with non-zero exit value 2
IntelliJ 编译方式可能会导致您 post 的错误(至少在我的情况下是这样)。我最近来自 Eclipse,其中在每个 运行 之后创建一个 'Clean Project'。在 IntelliJ 中,项目需要干净的构建才能成为 运行。
我避免每次都进行清理,在 build.gradle.
的 dexOptions 中禁用增量标志
和我的错误一样
Error:Execution failed for task ':app:dexDebug'. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-7-openjdk-amd64/bin/java'' finished with non-zero exit value 2enter code here
是因为它的依赖库重复了,我的例子是这样的
compile files('libs/httpcore-4.3.3.jar')
compile files('libs/httpmime-4.3.6.jar')
compile fileTree(include: ['*.jar'], dir: 'libs')
然后我把它固定成这样
compile fileTree(include: ['*.jar'], dir: 'libs')
删除其他设置导入库
希望对您有所帮助
将此添加到您的文件构建中。 gradle
defaultConfig {
multiDexEnabled true
}
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'
}
我 运行 遇到了同样的问题,我确实在构建文件中添加了 multiDexEnabled true
但都是徒劳的。但是执行以下操作并在 defaultConfig 中添加 multiDexEnabled true
解决了我的问题。
在您的清单中添加 MultiDexApplication,例如:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.multidex.myapplication">
<application
...
android:name="android.support.multidex.MultiDexApplication">
...
</application>
</manifest>
别忘了添加
defaultConfig {
multiDexEnabled true
}
他们帮了我大忙。参考:
通过删除项目库文件夹中的多个 jar 可以轻松解决此问题。
我正在构建我的 android 项目时,在我的项目中导入 docx4j 库后出现此错误。我应该怎么做才能摆脱这个异常。
Error:Execution failed for task ':app:dexDebug'. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-7-openjdk-amd64/bin/java'' finished with non-zero exit value 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") }
你也可以搭配一下,看看对你有没有帮助
我可能需要更多信息,但根据你问题的错误:
Error:Execution failed for task ':app:dexDebug'. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-7-openjdk-amd64/bin/java'' finished with non-zero exit value 2
IntelliJ 编译方式可能会导致您 post 的错误(至少在我的情况下是这样)。我最近来自 Eclipse,其中在每个 运行 之后创建一个 'Clean Project'。在 IntelliJ 中,项目需要干净的构建才能成为 运行。 我避免每次都进行清理,在 build.gradle.
的 dexOptions 中禁用增量标志和我的错误一样
Error:Execution failed for task ':app:dexDebug'. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-7-openjdk-amd64/bin/java'' finished with non-zero exit value 2enter code here
是因为它的依赖库重复了,我的例子是这样的
compile files('libs/httpcore-4.3.3.jar')
compile files('libs/httpmime-4.3.6.jar')
compile fileTree(include: ['*.jar'], dir: 'libs')
然后我把它固定成这样
compile fileTree(include: ['*.jar'], dir: 'libs')
删除其他设置导入库
希望对您有所帮助
将此添加到您的文件构建中。 gradle
defaultConfig {
multiDexEnabled true
}
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'
}
我 运行 遇到了同样的问题,我确实在构建文件中添加了 multiDexEnabled true
但都是徒劳的。但是执行以下操作并在 defaultConfig 中添加 multiDexEnabled true
解决了我的问题。
在您的清单中添加 MultiDexApplication,例如:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.multidex.myapplication">
<application
...
android:name="android.support.multidex.MultiDexApplication">
...
</application>
</manifest>
别忘了添加
defaultConfig {
multiDexEnabled true
}
他们帮了我大忙。参考:
通过删除项目库文件夹中的多个 jar 可以轻松解决此问题。