16

I am making a android application with needs google map.

I created a new project in eclipse and compiled it on an android phone, it worked, but when I import the google-play-services_lib to my workspace and added a reference to it in my project, it doesn't compile, hangs up for a while with the status bar showing (launching project 100%) and displays an error "Unable to execute dex: Java heap space"

Update: I also tried changing the eclipse.ini file to increase memory limit to 512 and 1024, but no use

-startup
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502
-product
org.eclipse.epp.package.java.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
1024M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
1024m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms256m
-Xmx1024m

PS: searched alot before posting a question

Frz Khan
  • 218
  • 3
  • 8
  • this has nothing to do with the library project. Try increasing the space. http://stackoverflow.com/questions/16412302/unable-to-execute-dex-because-of-java-heap-space-in-eclipse-with-a-tiny-android and this http://stackoverflow.com/questions/9379037/unable-to-execute-dex-java-heap-space-java-heap-space – Raghunandan Jan 04 '14 at 09:34
  • delete bin folder and R file from project restart eclipse i hope it helps you – Imtiyaz Khalani Jan 04 '14 at 09:35
  • check updated question, i tried that @Raghunandan – Frz Khan Jan 04 '14 at 09:44

2 Answers2

20

Conversion to Dalvik format failed: Unable to execute dex: Java heap space

The gist is: Keep increasing the Xms and Xmx values until it either works or you run out of physical memory.

in eclipse.ini

E.g.: -XX:MaxPermSize=1536m -Dosgi.requiredJavaVersion=1.5 -Xms40m -Xmx1536m

Community
  • 1
  • 1
Hardik
  • 17,179
  • 2
  • 35
  • 40
0

I had the same problem and since my pc has 2 GB memory I had to find another solution. I compiled the project from command line - so without Eclipse using gradle.

laplasz
  • 3,359
  • 1
  • 29
  • 40