java.lang.OutOfMemoryError

Hi everyone,
our app downloads several files locally to make them available offline.
It often happens that the app closes with this error in the console.

java.lang.OutOfMemoryError: Failed to allocate a 268435472 byte allocation with 25165824 free bytes and 96MB until OOM, max allowed footprint 460932552, growth limit 536870912

We have already tried to modify the manifest but we have not achieved great results.
Is there a way to configure infinite memory usage?
Do you have a solution to this problem?

So just checking, you’ve set

   android:largeHeap="true"

In your manifest?

Depending on how you are downloading these files (native java or with JavaScript), you’ll have different solutions.

If you’re doing it in Java, you just need to follow best practices with how your write your code.
Can you provide some more information?

We have already tried with android: largeHeap = “true” without any success.
We download the files with a javascript function and the File plugin: https://ionicframework.com/docs/native/file

The customer’s request is to have several files available offline and for this reason we download many files via javascript at the first installation and save them on the filesystem.
After a certain amount of time the app closes and in the console I have the error reported above

I am generally a huge homer for Angular’s HttpClient, but here’s one case where I would investigate using fetch instead, because it specifically allows streaming. Anything that fundamentally relies on XHR (like HttpClient does) won’t really be able to break giant objects down into manageable chunks, which I think could really help control your memory footprint here.