Error when loading a few images: java.lang.OutOfMemoryError


#1

I load only 5 images (but large dimensions : 3000*4000). Then my app crashes with this error:

java.lang.OutOfMemoryError

Or sometimes this error:

An uncaught Exception occurred on "AsyncTask #3" thread.
java.lang.RuntimeException: An error occured while executing doInBackground()
 at org.nativescript.widgets.image.AsyncTask$3.done(AsyncTask.java:326)
 at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
 at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
 at java.util.concurrent.FutureTask.run(FutureTask.java:242)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
 at java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.OutOfMemoryError: OutOfMemoryError thrown while trying to throw OutOfMemoryError; no stack trace available

Any idea?


#2

Optimize your images and use a plugin - https://docs.nativescript.org/best-practices/images-optimisations


#3

I installed this on the server and it has stopped our memory issues.

https://cimage.se/


#4

I think the solution is mentioned here in github issue.