Error running an app in Android Studio

Question:

I imported a project from eclipse to Android Studio (version 1.3.2), so far so good, but there was an error when I tried to run the program:

Error:Execution failed for task ':dexDebug'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_73\bin\java.exe'' finished with non- zero exit value 2

Can anyone help me solve this problem?

Answer:

Try this:

on the gradle of your project within dependencies add:

dependencies {
 compile 'com.android.support:multidex:1.0.1'
}

inside android does

android {
 dexOptions {
        preDexLibraries = false
        incremental true
        javaMaxHeapSize "4g"
    }

 defaultConfig {
        multiDexEnabled true
    }
}

Then the gradle is synchronized again, followed by a clean to the project.

Scroll to Top