6

I am having this error .

Error:Execution failed for task ':myApp:createDebugMainDexClassList'. com.android.ide.common.internal.LoggedErrorException: Failed to run command: java -Xmx1024M -cp \android-sdk\build-tools\19.1.0\lib\dx.jar com.android.multidex.ClassReferenceListBuilder myApp\build\intermediates\multi-dex\debug\componentClasses.jar myApp\build\intermediates\multi-dex\debug\allclasses.jar

Error Code: 1 Output: Error: Could not find or load main class com.android.multidex.ClassReferenceListBuilder

I am trying to use the multidex library because my application went over the 65000 method because i am using external libraries as Link describes ,I have added the lines in mainfest and build.gradle file,any tips would be appreciated.Thanks

EDIT after few launches I got this error.

Error:Execution failed for task ':myApp:dexDebug'. com.android.ide.common.internal.LoggedErrorException: Failed to run command: \android-sdk\build-tools\21.1.0\dx.bat --dex --no-optimize --multi-dex --main-dex-list myApp\build\intermediates\multi-dex\debug\maindexlist.txt --output myApp\build\intermediates\dex\debug --input-list=myApp\build\intermediates\tmp\dex\debug\inputList.txt ,,Error Code:3.

Output: UNEXPECTED TOP-LEVEL ERROR: java.lang.OutOfMemoryError: Java heap space

I tried to increase the size of Xms1024m -Xmx1024m which is in file 'studio64.exe.vmoptions' but it still does not help ,I also tried in Settings>Compiler>VM Options Xms1024m -Xmx1024m

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
M.Baraka
  • 725
  • 1
  • 10
  • 24
  • I found solution for second part in [LINK](http://stackoverflow.com/questions/27164452/how-to-solve-java-lang-outofmemoryerror-gc-overhead-limit-exceeded-error-in-and) – M.Baraka Jan 13 '15 at 14:31

1 Answers1

12

According to the multidex docs at https://developer.android.com/tools/building/multidex.html you need to be running build tools 21.1.0 or higher to use multidex. By your error message it looks like you're using 19.1.0. Try upgrading.

Scott Barta
  • 79,344
  • 24
  • 180
  • 163