App exit (crash) when load multiples big images


In my app I have fresco LIB but when images from camera are too bigs and load more than 3 images the app crashes/exits with no error, just closes the app

any idea??

nativescript │ 2.5.4
tns-core-modules │ 2.5.2
tns-android │ 2.5.0
nativescript-fresco │ ^1.0.16 │


I faced similar issues while reading/writing large files. Did you try adding android:largeHeap="true" to your application tag in manifest file.


didn’t fix it =( the app get slow… and eventually crash/exit


Did you try using nativescript-fresco?


Hi @multishiv19 , yeah i’m using fresco… thats why i’m asking… because it should handle that kind of things…


what is the average size of images you try to load?
I would recommend to keep it as small as possible.
Load larger images only inside things like nativescript-imageswiper


the images are from the camera, so… are 1MB to 3MB but I’m working in downsample the image, but I cant use imageswiper because the app has a layout predefined.


Here’s how you downsample it
you take the args.image you get from camera, then
say, source = args.image,
now you do,

    const fs = require("file-system");
    const folder = fs.knownFolders.documents().path;
    const fileName = "imagename.png";
    const path = fs.path.join(folder, fileName);
    const saved = source.saveToFile(path, "png", 100);

The variable saved, contains the downsampled file. you can upload that, or set as a source of image.

Cheers! Happy NativeScripting


hi, what would be “source” ?


source is an instance of ImageSource