Error loading libopenal32.dll when setting minimum Android version

I’m using the latest version of Monogame found on GitHub and compiled from source. I’m also setting the minimum Android version to API 10 (Android 2.3) which I read is the minimum version supported by Monogame.

When I set this minimum version I get an error when I try to play a SoundEffect:

[Mono] DllImport attempting to load: ‘openal32.dll’.
[Mono] DllImport error loading library ‘./libopenal32.dll’: ‘Cannot load library: load_library[1104]: Library ‘/data/data/com.yaawn.ninjaman/lib/./libopenal32.dll’ not found’.
[Mono] DllImport error loading library ‘./libopenal32.dll.so’: ‘Cannot load library: load_library[1104]: Library ‘/data/data/com.yaawn.ninjaman/lib/./libopenal32.dll.so’ not found’.
[Mono] DllImport error loading library ‘libopenal32.dll’: ‘Cannot load library: load_library[1104]: Library ‘/data/data/com.yaawn.ninjaman/lib/libopenal32.dll’ not found’.
[Mono] DllImport error loading library ‘libopenal32.dll.so’: ‘Cannot load library: load_library[1104]: Library ‘/data/data/com.yaawn.ninjaman/lib/libopenal32.dll.so’ not found’.
[Mono] DllImport error loading library ‘openal32.dll’: ‘Cannot load library: load_library[1104]: Library ‘/data/data/com.yaawn.ninjaman/lib/openal32.dll’ not found’.
[Mono] DllImport error loading library ‘./libopenal32’: ‘Cannot load library: load_library[1104]: Library ‘/data/data/com.yaawn.ninjaman/lib/./libopenal32’ not found’.
[Mono] DllImport error loading library ‘./libopenal32.so’: ‘Cannot load library: find_library[1219]: 1044 ‘libopenal32.so’ failed to load previously’.
[Mono] DllImport error loading library ‘libopenal32’: ‘Cannot load library: load_library[1104]: Library ‘/data/data/com.yaawn.ninjaman/lib/libopenal32’ not found’.
[Mono] DllImport error loading library ‘libopenal32.so’: ‘Cannot load library: find_library[1219]: 1044 ‘libopenal32.so’ failed to load previously’.
[Mono] DllImport error loading library ‘openal32’: ‘Cannot load library: load_library[1104]: Library ‘/data/data/com.yaawn.ninjaman/lib/openal32’ not found’.
[Mono] DllImport error loading library ‘./libopenal32.dll’: ‘Cannot load library: load_library[1104]: Library ‘/data/data/com.yaawn.ninjaman/lib/./libopenal32.dll’ not found’.
[Mono] DllImport error loading library ‘./libopenal32.dll.so’: ‘Cannot load library: load_library[1104]: Library ‘/data/data/com.yaawn.ninjaman/lib/./libopenal32.dll.so’ not found’.
[Mono] DllImport error loading library ‘libopenal32.dll’: ‘Cannot load library: load_library[1104]: Library ‘/data/data/com.yaawn.ninjaman/lib/libopenal32.dll’ not found’.
[Mono] DllImport error loading library ‘libopenal32.dll.so’: ‘Cannot load library: load_library[1104]: Library ‘/data/data/com.yaawn.ninjaman/lib/libopenal32.dll.so’ not found’.
[Mono] DllImport error loading library ‘libopenal32.dll’: ‘Cannot load library: load_library[1104]: Library ‘/data/data/com.yaawn.ninjaman/lib/libopenal32.dll’ not found’.
[Mono] DllImport unable to load library ‘Cannot load library: load_library[1104]: Library ‘/data/data/com.yaawn.ninjaman/lib/libopenal32.dll’ not found’.

I’m able to play a Song using MediaPlayer just fine. It’s just the SoundEffect that fails.

If I try it on a device with Android 4.4.2 it works. On an emulator with 2.3.7 it fails.

Are your monogame dependencies up to date?
We brought in openal for android here https://github.com/mono/MonoGame/pull/2750

Everything should be up to date.

From the link you mention, it says:

Target framework version raised to v4.2 (API Level 17) in Android and Ouya projects to allow testing for low latency sound support. Application projects should have “Compile using Android version” set to API Level 17, “Minimum Android to target” set to API Level 14 and “Target Android version” set to “Use Compile using SDK version”. This allows use of the functions to test low latency sound support (available in v4.2), but apps can still be run on v4.0 devices.

So if I understand correctly, Monogame on Android is no longer supported on Android lower than 4.0??

@KonajuGames - Is this correct?

I’m refering specifically to the Audio portion. I can compile my game just fine and everything works (playing a Song with MediaPlayer), no problems with video. It’s only when I try to play a SoundEffect that I get the OpenAL exception and the game crashes.

Willing to help any way I can, providing code, dumps, logs, let me know.

I’ve done some more testing and of course, I was wrong.

You can set the minimum Android API to 10 just fine, but if you use SoundEffects you have to convert them using Pipeline.exe (.wavs at least). Otherwise you’ll get OpenAL errors.

If you are using Android API 17 or above, your SoundEffects can be straight up .wavs and you can use them as is.

There is still a lot of lag pre 4.2 but that’s another issue.

Android’s sound support was very lacking (to put it nicely) prior to 4.2. As @nanexcool found, you can still run on lower versions, but it will have worse performance because Android’s engineers did not treat low latency audio as a priority back then. I have a document for Android versions in the Documentation section, but that section does not appear to be working properly at the moment.

I’m not sure why the Android version affects the loading of WAVs though. That will be something to look at.