问题
I imported a project from Eclipse to Android. Then I get this error message after I tried to run application:
Error:Execution failed for task ':app:dexDebug'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files (x86)\Java\jdk1.8.0_40\bin\java.exe'' finished with non-zero exit value 2
It seems like this problem: Error:Execution failed for task ':app:dexDebug'. com.android.ide.common.process.ProcessException
But I tried all of the answers and none of them worked.
Here is my build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "22.0.1"
compileOptions.encoding = 'windows-1251'
defaultConfig {
applicationId "sk.app"
minSdkVersion 15
targetSdkVersion 21
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:23.1.1'
compile 'com.google.code.gson:gson:2.3'
compile files('libs/activation.jar')
compile files('libs/droidText.0.4.jar')
compile files('libs/google-play-services.jar')
compile files('libs/mail.jar')
}
回答1:
I had this ProcessException.From what I have seen it is mainly due to the 64k method limitation. This may occur because your project has so many libraries added which may also mean that few of them are duplicate.
Issue I had was 64k limitation crossed because of duplicate dependencies included through PlayServices. ProcessException when buildToolsVersion is changed from 22.0.1 to 23.0.1 is my issue answered in SOF.
I think in your case that does not seem to be an issue for me. But still you can have multidex enabled. Do that too by following Building Apps with Over 65K Methods.
Also try the latest build tools version which is 23.0.2 from build-tools.
EDIT
For @EsoRimmer, it did not work just with MultiDex enabled but latest build tools version along with it made it work. So, using the latest build tools always a way to avoid unnecessary issues.
来源:https://stackoverflow.com/questions/33999588/errorexecution-failed-for-task-appdexdebug-after-importing-project-from-ecl