0

I've added a Java Library dependency module to the app module of my project. When I try to run the app I get this error:

...while parsing hai/shoplist/ItemBag.class 1 error; aborting Error:Execution failed for task ':app:preDexDebug'.com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException: Process 'command 'C:\ProgramFiles\Java\jdk1.8.0_05\bin\java.exe'' finished with non-zero exit value 1

I've tested the classes that I have in the module and I can even build it but the problem arises when I try to run the app.

Humberto
  • 1
  • 1

2 Answers2

0

Android doesn't support Java 8. Add to your library build.gradle:

sourceCompatibility = 1.7. 

It should solve your problem.

Alexey
  • 4,014
  • 1
  • 23
  • 29
-1

Due to Androids design, there is a limitation on how many methods your application may contain. You might have exceeded this amount. To solve this, enabled multidex support as explained here.

More information about it be found in the Android developer docs.

Community
  • 1
  • 1
Ken Van Hoeylandt
  • 4,804
  • 1
  • 34
  • 42
  • The problem is that I haven't reached the 65K methods limit. The whole project builds succesfully but the problem appears when I try to run the app. – Humberto Jul 11 '15 at 18:50
  • Your project absolutely does not build succesfully: I understand that you're trying to run the app, but it clearly says in your log that the task that fails is preDexDebug. As explained on http://stackoverflow.com/questions/19227611/what-is-android-pre-dexing-and-how-to-does-it-increase-performance "The DEX processes take your Java compiled JAR files and converts them into Dalvik Executable Files (.dex) files that will run on Android." You can even see that it's the java execution that fails - which is definitely not running the Android application (since Android uses Dalvik or ART) – Ken Van Hoeylandt Jul 13 '15 at 08:27