I get this error hundreds of times when I run in Debug, it doesn\'t seem to affect the program, but how do I get rid of it?
I know it can be traced back to the Sound
It is not possible for this error to be about heap size, because there aren't any device with such a small heap 1052672 ~ 1Mb., but about SoundPool buffer size.
SoundPool has hardcoded limit of 1Mb of raw PCM_16 data in memory. This limit applies for every sound you are loading into memory, and not for sounds in sum per one SoundPool. So the most voted answer about SoundPools is very wrong!
Let me introduce SoundPoolCompat which uses AudioTrack under the hood and have custom bufferSize. All data within specified buffer will be loaded into memory and played with small latency like SoundPool does. All data that exceed that bufferSize will be loaded on demand (which adds latency, similar to MediaPlayer). Api is very similart to SoundPool, also it is added a feature to load sounds from Uri (for example gdrive). And there is playOnce method, all resources will be unloaded after file is played.
implementation 'com.olekdia:sound-pool:3.0.2'
https://gitlab.com/olekdia/common/libraries/sound-pool