[SOLVED] Sound on Android with Monogame 3.6 crashes

I am currently using 3.5 for a project I am working on and decided to try 3.6 (want to play around with instancing).

I uninstalled 3.5 and installed the latest 3.6 build from today.

When I try running my game with 3.6, it complains it can’t find sdl2.dll

The game is an opengl game and currently running on Windows 10.

If I uninstall 3.6 and re-install 3.5, everything works as expected.

Is there something special I need to do to get 3.6 working?

Thanks.

Create a new (temporary) project for the cross desktop gl project template. There are some files you need to add to your project to get it to work with the current develop build. Be sure that the files get put in the same place and marked as content. Should be like 11 or so files, some in a sub directory. For windows only, you will only need a subset of them, as the others are for linux or mac. If you are windows only, then you can edit the config file to remove the others.

Thanks for the help. I’ll give that a try.

I got my OpenGL game working by modifying the project and adding the necessary files.

However, my Android project now fails to run with the following error:

System.InvalidOperationException: AL.LoadAll() needs a current AudioContext.

I am currently not using any Audio in the game… so not sure what’s causing the problem. I did create a blank Android project using 3.6 and compared it to my Android project and it looks the same.

On a slightly different note… another warning I now seem to be getting with my Android project (I may have also been getting it with my 3.5 project and never noticed it) is that I have some other reference projects which are used by both the Android and the OpenGL project… and when I compile the Android project I see the following warning:

  2>  No way to resolve conflict between "System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "System.Runtime.Serialization, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e". Choosing "System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" arbitrarily.
2>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2221,3): warning MSB3277: Found conflicts between different versions of the same dependent assembly that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed.

This seems to be due to the fact that the core .net assemblies using by Android (e.g. System) are different from the ones that are used by the shared projects i.e. MonoAndroid vs. MS .Net 4.5

I am not sure if they are contributing to the Audio context error (I suspect not)…

Thanks!

I added a sound to my test application and get the same error on Android and iOS as well. I created an issue for it #5074. I do not get any error resolving a conflict for my test. On each of the platforms for me, I get various warnings that I ignore without problems.

Thanks for replicating it. Hopefully someone knowledgeable on the issue will be able to address it soon.

You should probably change the title of the bug… The current title sounds less serious than it actually is.

Right now you cant even run any game on Android due to the bug. The framework audio initialization seems to be failing, even if you are not using audio.

I’ll have a look at this today.

@KonajuGames Thanks for looking into it!

PR #5086 added to fix Android launch. Removed assumption that EFX was available.

Thanks for fixing this so promptly! Will wait for the PR to be merged and a new build to be generated.

This PR has now been merged.

Great… thanks! I installed the latest build and all is good now.

Thanks for confirming it. Good to see.

@YTN You might change the subject to be something like “[solved] Loading sound on Android causes crash” or something.

I marked one of the issues I created while testing this closed (one for iOS and Android). The MacOS ones still fail with different problems.

Thanks!

@kennethsuda Updated title to reflect the thread.