[英]Execution failed for task ':hVFhirApp: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
當我在項目中導入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
將其添加到您的文件構建中。 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'
}
我可能需要更多信息,但根據您的問題的錯誤:
錯誤:任務':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中禁用增量標志。
我遇到了同樣的問題,我確實在構建文件中添加了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
}
這對我來說是個竅門。 參考: Android Studio無法使用錯誤org.gradle.process.internal.ExecException進行調試
我有同樣的錯誤。 但我通過在依賴項中的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 2enter code here
這是因為它依賴於lib的重復,在我的情況下是這樣的
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')
刪除其他設置import lib
我希望這有幫助
通過在項目libs文件夾中刪除多個jar,可以輕松解決此問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.