OutOfMemoryError in Android Studio

0 down vote
<a class="star-off" href="http://stackoverflow.com/questions/24303821/aspose-cells-in-android-studio-outofmemoryerror#" title="This is a favorite question (click again to undo)">favorite</a>
        </td>
    <p>I have referenced Aspose.Cells jar file in my Android Studio project, but I get the following error when I compile:</p>
Error:Execution failed for task ':kpi:preDexDebug'.

com.android.ide.common.internal.LoggedErrorException: Failed to run command:

C:\Users\jcmag_000\AppData\Local\Android\android-studio\sdk\build-tools\19.1.0\dx.bat
–dex --output
D:\Android\MockupBuilder\kpi\build\intermediates\pre-dexed\debug\aspose-cells-8.1.0-ee32824075207ab5167ea34e50ad48740612abbf.jar
D:\Android\MockupBuilder\kpi\libs\aspose-cells-8.1.0.jar
Error Code:
3
Output:
UNEXPECTED TOP-LEVEL ERROR:
java.lang.OutOfMemoryError: GC overhead limit exceeded
at com.android.dx.util.IntList.growIfNeeded(IntList.java:274)
at com.android.dx.util.IntList.add(IntList.java:217)
at
com.android.dx.util.LabeledList.addLabelIndex(LabeledList.java:96)
at com.android.dx.util.LabeledList.set(LabeledList.java:184)
at
com.android.dx.rop.code.BasicBlockList.set(BasicBlockList.java:77)
at
com.android.dx.ssa.back.SsaToRop.convertBasicBlocks(SsaToRop.java:259)
at com.android.dx.ssa.back.SsaToRop.convert(SsaToRop.java:123)
at
com.android.dx.ssa.back.SsaToRop.convertToRopMethod(SsaToRop.java:69)
at
com.android.dx.ssa.Optimizer.optimizeMinimizeRegisters(Optimizer.java:146)

      at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:106)
      at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:72)
      at 

com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:299)
at
com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:139)
at
com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:94)
at
com.android.dx.command.dexer.Main.processClass(Main.java:682)
at
com.android.dx.command.dexer.Main.processFileBytes(Main.java:634)
at com.android.dx.command.dexer.Main.access$600(Main.java:78)
at
com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:572)
at
com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)

      at 

com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)

      at 

com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)

      at com.android.dx.command.dexer.Main.processOne(Main.java:596)
      at 

com.android.dx.command.dexer.Main.processAllFiles(Main.java:498)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264)
at com.android.dx.command.dexer.Main.run(Main.java:230)
at com.android.dx.command.dexer.Main.main(Main.java:199)
at com.android.dx.command.Main.main(Main.java:103)

</div></div></td></tr></tbody></table>

Hi,

Thanks for your posting and using Aspose.Cells for Android.

It seems to be a Heap space problem. Please increase the heap space of VM. You can give it such value “-Xmx2000m

For Eclipse, you increase it using Eclipse.ini.

For Android Studio , you can go to your android-studio\bin folder and change this -Xmx values in studio.exe.vmoptions or studio64.exe.vmoptions files (depending on which version you are running), then restart Android Studio.

Thanks for your reply. I’ve updated the heap value (to 5000m) in studio64.exe.vmoptions, and I see the new value in Android Studio: http://i.imgur.com/pciXfY5.png
but still the same error…

any other parameter to change?

Hi,

Thanks for your posting and using Aspose.Cells for Android.

This is the only parameter that was needed to be changed. Could you increase it more and see how it behaves?

Kindly also provide the screenshot of how did you change this parameter. In case of Eclipse.ini, it looks like this as shown in screenshot.

Here is my studio64.exe.vmoptions file:

-Xms128m
-Xmx12000m
-XX:MaxPermSize=350m
-XX:ReservedCodeCacheSize=96m
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-Didea.project.structure.max.errors.to.show=0
-Djsse.enableSNIExtension=false
-XX:+UseCodeCacheFlushing
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-XX:+HeapDumpOnOutOfMemoryError
-Didea.platform.prefix=AndroidStudio
-Didea.paths.selector=AndroidStudioPreview

I see the 12Go size in Android Studio : http://i.imgur.com/xoFhpvh.png

same error… :frowning:

Hi,

Thanks for your feedback and using Aspose.Cells.

Please let us know your physical memory and also let us know your complete environment like OS, Android Studio version etc.

I have 16Go RAM, on Windows 8.1 64bits
Android Studio 0.6.1 (Build #AI-135.1224218)
JRE: 1.6.0_45-b06 amd64


Hi,

Thanks for your posting and using Aspose.Cells for Android.

We have logged this issue in our database for investigation. We will look into it and see how it could be resolved. Once, there is some fix or other update for you, we will let you know asap.

This issue has been logged as CELLSANDROID-45.

Hi,

Thanks for using Aspose.Cells for Android.

We can reproduce this issue on our end. But we do not know how to resolve
the issue now. Since, Android Studio is a new development tool and not
stable enough, we suggest you to develop your application using Eclipse.

ok, thanks for your support!

Hi,

Thanks for using Aspose.Cells for Android.

FYI: Please set the following in build.gradle in app model. It will work OK.

dexOptions {
javaMaxHeapSize “4g”
}


Post References:
( Not able to integrate aspose.pdf for android in android studio )
( How to display Excel file in android using aspose Cells lib )