【发布时间】:2015-10-23 07:18:01
【问题描述】:
我在我的应用程序中导入了一个模块。当我尝试运行它时,控制台向我显示此错误: **错误:任务 ':app:dexDebug' 执行失败。
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command'/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin/java '' 以非零退出值结束 2**
我有 2 个 gradle。
1st gradle(我的申请)
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')}
2nd gradle(模块导入)
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.*),但没有解决。
谢谢!
【问题讨论】:
-
你有超过 65k 的方法吗?如果是这样,您应该使用 multidex stackoverflow.com/a/27284064/706833
-
@iGoDa 我该怎么做?
-
要检查您是否有超过 65 个方法,您应该使用 proguard 功能来执行此操作,或者更简单地使用此库来检查有多少方法 github.com/KeepSafe/…
-
用'multiDexEnabled true'解决。
-
很高兴能帮上忙,添加答案可以帮助其他人解决这个问题
标签: java android android-studio gradle