[英]com.android.ide.common.process.ProcessException: Process ' finished with non-zero exit value 2
[英]app:transformClassesWithDexForDebug'. > com.android.ide.common.process.ProcessException: finished with non-zero exit value 1
我現在搜索了三天,但是找不到這些異常的答案:
錯誤:等級:任務':app:transformClassesWithDexForDebug'的執行失敗。
com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:進程'命令'C:\\ Program Files \\ Java \\ jdk1.8.0_60 \\ bin \\ java.exe'以非零退出值1
這是我的build.gradle文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '22.0.1'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "de.myApp"
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "4g" //specify the heap size for the dex process
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.android.gms:play-services-appindexing:8.4.0'
compile 'com.google.android.gms:play-services-auth:8.4.0'
compile 'com.android.support:multidex:1.0.1'
compile files('libs/achartengine-1.2.0.jar')
}
當我同步,清理並構建gradle項目時,一切都很好,但是當我想運行該應用程序時,出現了此異常……有人可以解決此問題嗎?
奇怪的是,在您的依賴項中看到compile 'com.android.support:multidex:1.0.1'
,同時還compile 'com.android.support:multidex:1.0.1'
minifyEnabled false
。
請檢查您使用的代碼和庫的方法數量是否超過65K,以便您需要使用多義處理,請參見此處的更多信息 。 您還可以按照Android docs的建議來正確實施多義處理。
如果您使用的是舊版本的gradle構建工具版本,此處也是'org.apache.http.legacy'
已知問題,請參閱如何將Apache HTTP API(舊版)添加為Android M的build.grade的編譯時依賴項?
避免使用以下內容:
試試這個新的配置:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
applicationId "de.myApp"
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.android.gms:play-services-appindexing:8.4.0'
compile 'com.google.android.gms:play-services-auth:8.4.0'
compile files('libs/achartengine-1.2.0.jar') // I would use MP Android Chart
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.