Android Audio Application template crashing at start up on Samsung S9

Hi,

I’ve generated an Audio Application project using Projucer, exported it through Android Studio (didn’t change anything in the Projucer configs or the code), successfully built the app and ran it on the device (samsung SM-960F). The app keeps crashing at start up with the following backtrace:

Signal: SIGBUS (signal SIGBUS: illegal address)

memcpy_to_i16_from_float 0x0000007d636b6638
flowgraph::SinkI16::read(void*, int) 0x0000007cd829f1c8
aaudio::AudioStreamInternalPlay::writeNowWithConversion(void const*, int) 0x0000007cd8293c08
aaudio::AudioStreamInternalPlay::processDataNow(void*, int, long, long*) 0x0000007cd8293664
aaudio::AudioStreamInternal::processData(void*, int, long) 0x0000007cd8290e4c
aaudio::AudioStreamInternalPlay::callbackLoop() 0x0000007cd82931d8
___lldb_unnamed_symbol15$$libaaudio.so 0x0000007cd827c38c
__pthread_start(void*) 0x0000007d65da6b28
__start_thread 0x0000007d65d48334

I’ve tried this with JUCE 6.0.5 and android ndk 21.0.6113669, and JUCE 6.0.7 both with ndk 21.0.6113669 and 22.0.7026061 (forced it through ndkVersion in gradle) which appears to be the latest.

The device is running Android 10.

Min SDK and Target SDK are the default ones (19 and 29) respectively, but I’ve also tried with 26 and the result is still the same.

I can get by this crash if I launch the app with some external BT speaker connected prior, so the problem must come from the device’s default audio device. I tried my best trying to debug the problem but as you can see the crash actually happens inside libaaudio.so, so I’m kinda blindfolded. It definitely happens shortly after the output stream is started, during the first callback.

Same issue here, but no useful info: Crash on Android on libaudioutils.memcpy_to_i16_from_float (memcpy_to_i16_from_float:212) - Community Q&A

Does somebody know something about this?
Thanks

I can get by this crash if I launch the app with some external BT speaker connected prior

That is an interesting clue. Bluetooth devices typically use the Legacy path in AAudio. But AudioStreamInternalPlay::writeNowWithConversion is in the MMAP path. Maybe it is in the process of switching devices.

We are tracking this issue here:

Please see the Oboe issue for the latest analysis.

1 Like