Saturday 28 January 2012

Solution for Unable to execute dex: Java heap space in android


Unable to execute dex: Java heap space

Recent third-party libraries to use android-sdk-windows \ platforms \ android-8 \ data \ layoutlib.jar, but there Conversion to Dalvik format failed: Unable to execute dex: null this problem. And a dialog box

Here is solution: 
(Note: Red denotes a tried, but no, the green marker indicates tried feasible.) As Android Developer, I have met a Strange problem when I want use a third Party JAR, it remained Me that:    Dex Loader] Unable to execute dex: null    Conversion to Dalvik format failed: Unable to execute dex: null    out of Memory Error ... An Internal Error occurred during: "Build Project."    Java heap space    This is the DEX Error, I Find the Solutions by Google, one way is to Modify the eclipse.ini, you CAN Increase the Memory allocated in eclipse.ini to this: -Xms128m-Xmx512m or something higher , but this Did not work for Me. After Modify the eclipse.ini, I Can not Start the Eclipse. By StackOverflow, I Find a Solution:    eclipse.ini file must have on-vm path on first line and second line. Do not try to put everything into one line!    -vm    C: \ Program Files \ Java \ jdk1.6.0_07 \ bin \ javaw.exe    After add the-vm and the path in My eclipse.ini, I CAN Start My Eclipse and the problem has been resolved.    Another way to Solve the "Conversion to Dalvik format failed: Unable to execute dex: null "problem is using the user Library, the Concrete steps are as follows:    1. Right-Click the Project in Eclipse and SELECT "Build Path -> Add Libraries ...."    2. Select from the List and User Library Click Next.    3. Click the "User Libraries ..." button.    4. Click "New ..." in the User Libraries dialog.    5. Give the user a name and SELECT the Library System Library CheckBox and Click OK.    6. Highlight the newly added in the user Library List and Click the "Add JARs ..." button and add the desired JAR Files.    7. Click OK on the User Libraries dialog.    8. Make sure the new user Library is checked in the Add Library dialog and ...