Android build crushes with NoAudioHardwareException

Hi, recently I upgraded to 3.7.0.1708 version of Monogame and now then I’m trying to run anything on my android phones (Xiaomi Note 4x and Xiaomi Rednote 5) I get “Microsoft.Xna.Framework.Audio.NoAudioHardwareException android” right of the bat.
The only version I could see in NuGet to downgrade is 3.7.0.1681-develop and same error there.
I found this issue here https://github.com/MonoGame/MonoGame/issues/6382 and It looks like it was resolved, but no luck for me. Maybe it happens only on Xiaomi phones with MIUI, as the last comment suggested, but still it should be fixed from 3.7.0.1679 onwards.
I don’t know what to do at this point, how can I downgrade to 3.7.0.1679 for example? I lost installer for my old version and compiling full monogame source is beyond my capabilities.

It could also be related to this: https://github.com/MonoGame/MonoGame/issues/4717

Personally I think this behavior is odd and dislike it, but it seems it’s been fixed on some platforms. Are your Android speakers working correctly?

What about compiling MonoGame from source is not feasible for you? It’s actually fairly easy:

  1. Follow the instructions for building here: https://github.com/MonoGame/MonoGame
  2. After building, copy the DLL files into the destination (Ex. C:\Program Files (x86)\MonoGame\v3.0\Assemblies\Android on Windows)
1 Like

Thanks for an answer!

I’m 100% sure both phones have working audio and speakers working ok. And it was working with older version a day ago. I found it strange no one else wrote about this problem, Android is probably the most popular Monogame build target and Xiaomi is one of the most popular phones.

I personally have a very bad understanding of compiling and github. Where can I find older version full source code? And maybe by any chance, there is a place to find older installers like an archive of some sort? version <= 3.7.0.1621

Curse the day I deleted monogame installer with the older version I was using.

The GitHub repository has all the source code for MonoGame. Git’s version control allows easy collaboration and backup, allowing you to select previous versions if need be. More information on that here.

You can find the older builds on TeamCity, but I don’t think they keep older installers around for long, if at all. It looks like this version is the one you’re looking for. Using the information on the page, I traced it down to this commit.

So if you had the repository cloned and are familiar with version control, you would simply checkout the revision 307685cf0b2b736bfbf39b677b5f2042e167dfb2 then build from source to get the DLLs you need.

Though I was already familiar with GitHub, I wasn’t keen on building from source until I encountered issues with certain versions and couldn’t run installers for previous versions since they didn’t exist anymore. Now I actually find it better, since building includes the XML comments, which are curiously absent from the installers, for Visual Studio’s Intellisense.

@Kimimaru, thank you very much! Only because of you I was able not only to build different Monogame versions but I was able to help debug it and help fix the issue at https://github.com/MonoGame/MonoGame/issues/6452
If not for your messages I would’ve probably just given up, so thank you!

Also here is full beginner guide for building any versions:
-Open terminal (win+R and type “CMD”)
-Check if you have git at all with “git --version” command and download it if you don’t
-You need a git directory, create one by using a command “git init”
-git clone https://github.com/MonoGame/MonoGame.git
-git submodule update --init
-cd monogame
-start Protobuild.exe
-To get a commit ID, go to https://github.com/MonoGame/MonoGame/commits/ find one you need and copy sha1 (it’s on the far right)
-git checkout (like: git checkout 6f34eb393aa0ac005888d74c5c4c6ab5615fdc8c)
-Open a project you need, Monogame.Framework.Android in our case
-There probably will be errors about missing sdk. Open properties of each subproject and check sdk target. After that go to Tools->Android->Sdk manager and install them
-Build
-Go to monogame.framework->bin->… find dlls and copy them to C:\Program Files (x86)\MonoGame\v3.0\Assemblies\Android

1 Like

That’s awesome! I’m glad it worked out for you, and thanks for helping fix the issue!

1 Like