Free Support Forum - aspose.com

Creating Presentationx object in android studio project gives "out of memory" error

In android studio project,

PresentationX pptx = new PresentationX() code line gives “out of memory” error in runtime.
Logs and gradle file are below.

HeapSize in gradle file is increased. But, we get same error again.
Is there any solution for this error.?

build.gradle file
dexOptions {
incremental true
javaMaxHeapSize “2048M”
}


Error logs:


01-01 08:34:49.601 264-276/system_process I/ActivityManager﹕ Start proc com.test.asposeslidetest for activity com.test.asposeslidetest/.MainActivity: pid=24407 uid=10044 gids={1028}
01-01 08:34:50.001 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ Could not find method android.view.ViewGroup.onRtlPropertiesChanged, referenced from method android.support.v7.widget.Toolbar.onRtlPropertiesChanged
01-01 08:34:50.001 24407-24407/com.test.asposeslidetest W/dalvikvm﹕ VFY: unable to resolve virtual method 13123: Landroid/view/ViewGroup;.onRtlPropertiesChanged (I)V
01-01 08:34:50.021 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.internal.widget.TintTypedArray.getChangingConfigurations
01-01 08:34:50.021 24407-24407/com.test.asposeslidetest W/dalvikvm﹕ VFY: unable to resolve virtual method 405: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
01-01 08:34:50.021 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.internal.widget.TintTypedArray.getType
01-01 08:34:50.021 24407-24407/com.test.asposeslidetest W/dalvikvm﹕ VFY: unable to resolve virtual method 427: Landroid/content/res/TypedArray;.getType (I)I
01-01 08:34:50.742 24407-24407/com.test.asposeslidetest I/dalvikvm-heap﹕ Grow heap (frag case) to 7.432MB for 231334-byte allocation
01-01 08:34:50.772 24407-24407/com.test.asposeslidetest I/dalvikvm-heap﹕ Grow heap (frag case) to 7.480MB for 162874-byte allocation
01-01 08:34:51.082 24407-24407/com.test.asposeslidetest I/dalvikvm-heap﹕ Grow heap (frag case) to 8.011MB for 524304-byte allocation
01-01 08:34:52.083 24407-24407/com.test.asposeslidetest I/dalvikvm-heap﹕ Grow heap (frag case) to 9.353MB for 420958-byte allocation
01-01 08:34:52.133 24407-24407/com.test.asposeslidetest I/dalvikvm-heap﹕ Grow heap (frag case) to 9.958MB for 844526-byte allocation
01-01 08:34:52.674 24407-24407/com.test.asposeslidetest I/dalvikvm-heap﹕ Grow heap (frag case) to 10.224MB for 262160-byte allocation
01-01 08:34:53.004 24407-24407/com.test.asposeslidetest I/dalvikvm-heap﹕ Grow heap (frag case) to 11.272MB for 465483-byte allocation
01-01 08:34:59.650 264-277/system_process W/ActivityManager﹕ Activity idle timeout for ActivityRecord{41935560 com.test.asposeslidetest/.MainActivity}
01-01 08:35:21.111 24407-24414/com.test.asposeslidetest I/dalvikvm﹕ Jit: resizing JitTable from 4096 to 8192
01-01 08:35:40.891 24407-24409/com.test.asposeslidetest I/dalvikvm-heap﹕ Clamp target GC heap from 48.587MB to 48.000MB
01-01 08:35:42.242 24407-24409/com.test.asposeslidetest I/dalvikvm-heap﹕ Clamp target GC heap from 49.448MB to 48.000MB
01-01 08:35:43.173 24407-24407/com.test.asposeslidetest I/dalvikvm-heap﹕ Clamp target GC heap from 49.622MB to 48.000MB
01-01 08:35:43.924 24407-24407/com.test.asposeslidetest I/dalvikvm-heap﹕ Clamp target GC heap from 49.629MB to 48.000MB
01-01 08:35:43.924 24407-24407/com.test.asposeslidetest I/dalvikvm-heap﹕ Forcing collection of SoftReferences for 2064-byte allocation
01-01 08:35:44.674 24407-24407/com.test.asposeslidetest I/dalvikvm-heap﹕ Clamp target GC heap from 49.621MB to 48.000MB
01-01 08:35:45.625 24407-24409/com.test.asposeslidetest I/dalvikvm-heap﹕ Clamp target GC heap from 49.809MB to 48.000MB
01-01 08:35:46.426 24407-24409/com.test.asposeslidetest I/dalvikvm-heap﹕ Clamp target GC heap from 49.860MB to 48.000MB
01-01 08:35:47.187 24407-24407/com.test.asposeslidetest I/dalvikvm-heap﹕ Clamp target GC heap from 49.867MB to 48.000MB
01-01 08:35:47.187 24407-24407/com.test.asposeslidetest I/dalvikvm-heap﹕ Forcing collection of SoftReferences for 528-byte allocation
01-01 08:35:47.958 24407-24407/com.test.asposeslidetest I/dalvikvm-heap﹕ Clamp target GC heap from 49.867MB to 48.000MB
01-01 08:35:47.958 24407-24407/com.test.asposeslidetest E/dalvikvm-heap﹕ Out of memory on a 528-byte allocation.
01-01 08:35:47.958 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ “main” prio=5 tid=1 RUNNABLE
01-01 08:35:47.958 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ | group=“main” sCount=0 dsCount=0 obj=0x410b8568 self=0x410a8a08
01-01 08:35:47.958 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ | sysTid=24407 nice=0 sched=0/0 cgrp=[fopen-error:2] handle=1075463728
01-01 08:35:47.958 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ | schedstat=( 0 0 0 ) utm=3581 stm=65 core=0
01-01 08:35:47.968 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.fj.((null):~-1)
01-01 08:35:47.968 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.nj.((null):-1)
01-01 08:35:47.968 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.ma.((null):-1)
01-01 08:35:47.968 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.ma.((null):-1)
01-01 08:35:47.968 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.ra.do((null):-1)
01-01 08:35:47.968 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.px.do((null):-1)
01-01 08:35:47.968 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.rb.do((null):-1)
01-01 08:35:47.968 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.sv.do((null):-1)
01-01 08:35:47.968 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.qo.do((null):-1)
01-01 08:35:47.968 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.pu.if((null):-1)
01-01 08:35:47.968 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.pu.do((null):-1)
01-01 08:35:47.968 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.pu.do((null):-1)
01-01 08:35:47.968 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.pu.do((null):-1)
01-01 08:35:47.968 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.pu.do((null):-1)
01-01 08:35:47.968 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.pu.do((null):-1)
01-01 08:35:47.968 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.pu.do((null):-1)
01-01 08:35:47.968 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.pu.do((null):-1)
01-01 08:35:47.968 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.pu.do((null):-1)
01-01 08:35:47.968 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.sy.else((null):-1)
01-01 08:35:47.968 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.pu.do((null):-1)
01-01 08:35:47.968 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at com.aspose.slides.bdl.do((null):-1)
01-01 08:35:47.968 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at com.aspose.slides.bdl.do((null):-1)
01-01 08:35:47.968 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at com.aspose.slides.bdl.((null):-1)
01-01 08:35:47.968 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at com.aspose.slides.PresentationEx.((null):-1)
01-01 08:35:47.968 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at com.aspose.slides.PresentationEx.((null):-1)
01-01 08:35:47.968 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at com.test.asposeslidetest.MainActivity.powerPointXAction(MainActivity.java:103)
01-01 08:35:47.968 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at com.test.asposeslidetest.MainActivity.onCreate(MainActivity.java:29)
01-01 08:35:47.968 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at android.app.Activity.performCreate(Activity.java:5008)
01-01 08:35:47.968 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
01-01 08:35:47.968 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
01-01 08:35:47.978 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
01-01 08:35:47.978 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at android.app.ActivityThread.access$600(ActivityThread.java:130)
01-01 08:35:47.978 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
01-01 08:35:47.978 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at android.os.Handler.dispatchMessage(Handler.java:99)
01-01 08:35:47.978 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at android.os.Looper.loop(Looper.java:137)
01-01 08:35:47.978 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at android.app.ActivityThread.main(ActivityThread.java:4745)
01-01 08:35:47.978 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at java.lang.reflect.Method.invokeNative(Native Method)
01-01 08:35:47.978 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at java.lang.reflect.Method.invoke(Method.java:511)
01-01 08:35:47.978 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
01-01 08:35:47.978 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
01-01 08:35:47.978 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ at dalvik.system.NativeStart.main(Native Method)
01-01 08:35:47.978 24407-24407/com.test.asposeslidetest I/dalvikvm﹕ [ 01-01 08:35:47.978 24407:24407 W/dalvikvm ]
Exception Ljava/lang/OutOfMemoryError; thrown while initializing Lcom/aspose/slides/bdl;
01-01 08:35:47.978 24407-24407/com.test.asposeslidetest W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x410b7300)
01-01 08:35:48.688 24407-24407/com.test.asposeslidetest E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.ExceptionInInitializerError
at com.aspose.slides.PresentationEx.(Unknown Source)
at com.aspose.slides.PresentationEx.(Unknown Source)
at com.test.asposeslidetest.MainActivity.powerPointXAction(MainActivity.java:103)
at com.test.asposeslidetest.MainActivity.onCreate(MainActivity.java:29)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
at android.app.ActivityThread.access$600(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.OutOfMemoryError
at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.fj.(Unknown Source)
at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.nj.(Unknown Source)
at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.ma.(Unknown Source)
at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.ma.(Unknown Source)
at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.ra.do(Unknown Source)
at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.px.do(Unknown Source)
at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.rb.do(Unknown Source)
at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.sv.do(Unknown Source)
at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.qo.do(Unknown Source)
at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.pu.if(Unknown Source)
at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.pu.do(Unknown Source)
at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.pu.do(Unknown Source)
at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.pu.do(Unknown Source)
at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.pu.do(Unknown Source)
at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.pu.do(Unknown Source)
at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.pu.do(Unknown Source)
at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.pu.do(Unknown Source)
at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.pu.do(Unknown Source)
at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.sy.else(Unknown Source)
at com.aspose.slides.pf4dd765c.pbdb106a0.p9f36407e.pu.do(Unknown Source)
at com.aspose.slides.bdl.do(Unknown Source)
at com.aspose.slides.bdl.do(Unknown Source)
at com.aspose.slides.bdl.(Unknown Source)
at com.aspose.slides.PresentationEx.(Unknown Source)
at com.aspose.slides.PresentationEx.(Unknown Source)
at com.test.asposeslidetest.MainActivity.powerPointXAction(MainActivity.java:103)
at com.test.asposeslidetest.MainActivity.onCreate(MainActivity.java:29)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
at android.app.ActivityThread.access$600(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
01-01 08:35:48.708 264-644/system_process W/ActivityManager﹕ Force finishing activity com.test.asposeslidetest/.MainActivity
01-01 08:35:49.259 264-277/system_process W/ActivityManager﹕ Activity pause timeout for ActivityRecord{41935560 com.test.asposeslidetest/.MainActivity}
01-01 08:35:59.359 264-277/system_process W/ActivityManager﹕ Activity destroy timeout for ActivityRecord{41935560 com.test.asposeslidetest/.MainActivity}
01-01 08:36:07.887 24407-24407/com.test.asposeslidetest I/Process﹕ Sending signal. PID: 24407 SIG: 9
01-01 08:36:07.967 264-264/system_process I/ActivityManager﹕ Process com.test.asposeslidetest (pid 24407) has died.

Hi Ozan,

I have observed your comments and have read that increasing the heap size has not resolved the things on your end. I have created an issue with ID SLIDESANDROID-30 in our issue tracking system to further investigate and resolve the issue. However, I suggest you to please try using Aspose.Slides for Cloud Api which is better alternate to Aspose.Slides for Android as it lacks rendering support at the moment and will be available tentatively during Q2 of 2016. We also provide the SDK in different languages to support Aspose.Slides for Cloud.

We are sorry for your inconvenience,