6
 Error:Execution failed for task ':app:dexDebug'. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-8-oracle/bin/java'' finished with non-zero exit value 2

Have tried this answer

but my problem still not solved. How can i solve it?

Community
  • 1
  • 1
Harman
  • 1,168
  • 1
  • 9
  • 19

2 Answers2

4

Try to enable MultiDex to fix 65k methods error by adding this to your build.gradle

defaultConfig {
    multiDexEnabled true
}

Also check for duplicated libraries usage (sometimes multiple libraries use same dependency like support-v4)

Ivan V
  • 3,024
  • 4
  • 26
  • 36
  • have tried this..but it gives another error - Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'. > java.util.zip.ZipException: duplicate entry: android/support/annotation/StyleableRes.class – Harman Jul 02 '15 at 13:23
  • I edited my answer, check if one of your libraries (usually support-v4) is being used by multiple dependencies. If so you can exclude this module from one of them! – Ivan V Jul 02 '15 at 13:31
  • hey found the solution. it was having multiple libraries using same dependency. thanks :) – Harman Jul 03 '15 at 20:19
0

This error could occur if some of your jar files does not compile. You should go into your build.gradle file in your project, and look in your dependencies.

If you're just importing some jar files, you could try to remove them and add them one at a time. This will help you determine which one of them causes the error.

In my case, I did just that, and when I was importing the last one, the app compiled. So I think the real problem was that I was importing too many at once. But now it all works.

Other possible issue its dependency error, clean gradle before build

Kartheek
  • 7,104
  • 3
  • 30
  • 44