本文介绍了错误:用非零值2结束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经导入模块中我的申请。当我尝试运行它,控制台显示此错误:
**错误:执行失败的任务:应用程序:dexDebug

i've imported a module in my application. When i try to run it, console show me this error:**Error:Execution failed for task ':app:dexDebug'.

com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:过程'命令'/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin/java ''完成了非零退出值2 **

我有2 gradle这个。

I've 2 gradle.

1 gradle这个(我的应用程序)

1st gradle (my application)

apply plugin: 'test.test.myapplication'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
    applicationId "alo.com.geoapp"
    minSdkVersion 8
    targetSdkVersion 19
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
productFlavors {
}

}dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile files('libs/gson-2.2.2.jar')
compile project(':sdktools')}

第二gradle这个(模块进口)

2nd gradle (module imported)

apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion "20.0.0"
defaultConfig {
    minSdkVersion 8
    targetSdkVersion 19
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
    }
}
}


dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/SKMaps.jar')
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.google.guava:guava:18.0'
compile 'joda-time:joda-time:2.4'}

我已经尝试过更新我的JDK(从7 *至8 *),而不是解决问​​题。

i've already tried to update my jdk (from 7.* to 8.*), but not resolve.

谢谢!

推荐答案

如果你有超过65000的方法,你应该使用multidex(的)。

If you have more than 65k methods you should use multidex (http://developer.android.com/tools/building/multidex.html).

您gradle这个:

multiDexEnabled true

要检查,如果你有超过65个方法,你应该使用ProGuard的功能,或者更简单地使用这个LIB只是为了检查有多少方法<一href=\"https://github.com/KeepSafe/dexcount-gradle-plugin?utm_source=Android+Weekly&utm_campaign=553bcbfc02-Android_Weekly_174&utm_medium=email&utm_term=0_4eb677ad19-553bcbfc02-337295057\" rel=\"nofollow\">https://github.com/KeepSafe/dexcount-gradle-plugin?utm_source=Android+Weekly&utm_campaign=553bcbfc02-Android_Weekly_174&utm_medium=email&utm_term=0_4eb677ad19-553bcbfc02-337295057

To check if you have more than 65 methods you should use proguard feature, or more simply use this lib just to check how many methods https://github.com/KeepSafe/dexcount-gradle-plugin?utm_source=Android+Weekly&utm_campaign=553bcbfc02-Android_Weekly_174&utm_medium=email&utm_term=0_4eb677ad19-553bcbfc02-337295057

这篇关于错误:用非零值2结束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 20:51