简体   繁体   中英

Error: finished with non-zero exit value2

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: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2**

I've 2 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')}

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'}

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

thank you!

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

on your gradle:

multiDexEnabled true

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

Your compilesdkversion and targetsdkversion are different update your Targetsdkversion and compilesdkversion same version

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')
 }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM