I try to compile apk using Appcelerator but i get this error. How to solve it.
Currently I'm using Titanium sdk: 5.2.0.GA
>Error:
>ERROR : Failed to run dexer:
>ERROR : UNEXPECTED TOP-LEVEL ERROR:
>ERROR : java.lang.OutOfMemoryError: Java heap space
Other error
[ERROR] : Failed to run dexer: [ERROR] :
[ERROR] : UNEXPECTED TOP-LEVEL ERROR: [ERROR] : java.lang.OutOfMemoryError: Java heap space [ERROR] : at java.util.Arrays.copyOf(Arrays.java:2271) [ERROR] : at java.io.ByteArrayOutputStream.toByteArray(ByteArrayOutputStream.java:191) [ERROR] : at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:279) [ERROR] : at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166) [ERROR] : at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144) [ERROR] : at com.android.dx.command.dexer.Main.processOne(Main.java:672) [ERROR] : at com.android.dx.command.dexer.Main.processAllFiles(Main.java:574) [ERROR] : at com.android.dx.command.dexer.Main.runMonoDex(Main.java:311) [ERROR] : at com.android.dx.command.dexer.Main.run(Main.java:277) [ERROR] : at com.android.dx.command.dexer.Main.main(Main.java:245) [ERROR] : at com.android.dx.command.Main.main(Main.java:106)
Hi again, I get the solution from the link and the code is :
<property name="android.javac.maxmemory" type="string">1024M</property> <property name="android.dx.maxmemory" type="string">2048M</property>
Thanks
You're doing something wrong in your code. And setting a larger maxmemory
or large heap size is not the correct fix. Such solutions won't work on all devices and Android versions. You're requesting more memory but there's nothing that requires the OS to grant it to your app.
You've got a memory leak or you're just unnecessarily using memory creating objects in inefficient ways. Re-examine your app's structure to optimize it rather than band-aiding it with a manifest setting.