我在我的应用程序中导入了一个模块。当我尝试运行它时,控制台显示此错误: **错误:任务':app:dexDebug'。
的执行失败com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:Process' command' /Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents /首页/斌/ 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')}
第二个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. *),但没有解决。
谢谢你!答案 0 :(得分:5)
如果你有超过65k的方法,你应该使用multidex(http://developer.android.com/tools/building/multidex.html)。
在你的gradle上:
multiDexEnabled true
要检查您是否有超过65种方法,您应该使用proguard功能,或者更简单地使用此lib只检查方法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
答案 1 :(得分:1)
您的compilesdkversion
和targetsdkversion
不同,更新了您的Targetsdkversion
和compilesdkversion
相同版本
apply plugin: 'test.test.myapplication'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "alo.com.geoapp"
minSdkVersion 8
targetSdkVersion 21 //here
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
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')
}