1

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')
}
Community
  • 1
  • 1
Jakub Smolar
  • 81
  • 10
  • can you try latest build tools version 23.0.2 from http://developer.android.com/tools/revisions/build-tools.html ? – cgr Nov 30 '15 at 14:21
  • I tried it, and have the same error message – Jakub Smolar Nov 30 '15 at 15:27
  • Can you enable multidex with this http://developer.android.com/intl/es/tools/building/multidex.html or you added it in your gradle already ? – cgr Nov 30 '15 at 15:36
  • I tried it before, but not with latest build tools. Now it works, thank you. – Jakub Smolar Nov 30 '15 at 15:44
  • That's great. It took a month for me to get this resolved though not coninuosly I was working on it. I was a bit in middle mind as to whether post answer or not as I was not totally sure. Added answer now for other's sake. You may accept and vote to give it a confidence.. ;) – cgr Nov 30 '15 at 15:51

1 Answers1

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.

Community
  • 1
  • 1
cgr
  • 4,578
  • 2
  • 28
  • 52