Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android projects cannot initialize AudioDevice #6382

Closed
MattiKloepper opened this issue Jul 26, 2018 · 14 comments

Comments

Projects
None yet
4 participants
@MattiKloepper
Copy link

commented Jul 26, 2018

I'm experiencing a problem with running android projects in Monogame 3.7.0.1641. To narrow things down I have created a completely new Monogame Android through the current Visual Studio 2017 template.

In the main activity the template creates a new Game object with "var g = new Game1();". Running this code on either an Android emulator (Oreo 8.0 and 8.1 devices created with the Android Device Manager) or an my Samsung Galaxy Tab throws an Exception in the Game-Class constructor.

Exception: Microsoft.Xna.Framework.Audio.NoAudioHardwareException
Inner Exception: System.NullReferenceException
Message: "OpenAL device could not be initialized."
Source: MonoGame.Framework
Stacktrace:
at Microsoft.Xna.Framework.Audio.OpenALSoundController.OpenSoundController () [0x00031] in :0
at Microsoft.Xna.Framework.Audio.OpenALSoundController..ctor () [0x00011] in :0
at Microsoft.Xna.Framework.Audio.OpenALSoundController.get_GetInstance () [0x00007] in :0
at Microsoft.Xna.Framework.AndroidGamePlatform..ctor (Microsoft.Xna.Framework.Game game) [0x00060] in :0
at Microsoft.Xna.Framework.GamePlatform.PlatformCreate (Microsoft.Xna.Framework.Game game) [0x00000] in :0
at Microsoft.Xna.Framework.Game..ctor () [0x001fb] in :0
at Test.Droid.Game1..ctor () [0x00000] in [...]\Test.Droid\Game1.cs:16
at Test.Droid.Activity1.OnCreate (Android.OS.Bundle bundle) [0x0000a] in [...]\Test.Droid\Activity1.cs:24

The android emulators as well as the physical Samsung tablet produces sounds without problems in other apps or the OS.

Is there anything I can do to repair this problem or at least to deactivate the AudioHardwareInitialization?

Kind regards,
Matti

What version of MonoGame does the bug occur on:

  • MonoGame 3.7.0.1641

What operating system are you using:

  • Windows

What MonoGame platform are you using:

  • Android
@mrhelmut

This comment has been minimized.

Copy link
Contributor

commented Jul 26, 2018

Would you mind trying to use a MonoGame older than this commit (or revert it)? 017c1a7

@MattiKloepper

This comment has been minimized.

Copy link
Author

commented Jul 26, 2018

Very well. Seems like that has been some sort of installation issue on my machine. Since I created the project with build 3.7.0.1641 installed vie the Setup program I switched to NuGet. Problem still occurs with older builds.
I than removed the Monogame and OpenTK references from the Project and switch back to 1641 via Nuget. It is working now?!

Even if I create a new project without Nuget this works now, too.

I guess there has been some probmles with incrementally upgrading my nuget packages through the last weeks. Just sorry that I can't recreate the problem. Thanks for your Suggestion anyway :-)

@mrhelmut

This comment has been minimized.

Copy link
Contributor

commented Jul 26, 2018

No worry, glad it worked.
The nuget uses an older version, so it may still be an issue on more recent work. There has been a bunch of refactoring lately that may have introduce it.

If you happen to try again a nightly build, please drop by to confirm if it worked.

@MattiKloepper MattiKloepper reopened this Jul 26, 2018

@MattiKloepper

This comment has been minimized.

Copy link
Author

commented Jul 26, 2018

Sorry for the hassle. I have been quite curious About the cause of this Problem and did some completly clean reinstallations.
New Solution in Visualstudio 2017 with just a single MonoGame Android Project created from the template an no changes.
Just using the installed libraries, no nuget packages.

MonaGame version changes have been performed via uninstallation, reboot, cleaning the solution in Visualstudio and rebuilding.

This works for up to MonoGame 3.7.1608 but produces the originally described Problem from 3.7.1624 onward. Will try the intermediate versions now to pinpoint the Problem to a specific build.

@MattiKloepper

This comment has been minimized.

Copy link
Author

commented Jul 26, 2018

I narrowed it down. The problem has been intruduced with build 3.7.1622.
With build 3.7.1621 the game constructor works without a problem.

@cra0zy

This comment has been minimized.

Copy link
Member

commented Jul 26, 2018

With build 3.7.1621

That's not a development build, its a PR build: http://teamcity.monogame.net/viewType.html?buildTypeId=MonoGame_DevelopWin&tab=buildTypeHistoryList&branch_MonoGame=__all_branches__

Test out builds 3.7.0.1620 and 3.7.0.1614 if you have time, that will tell me if the commit mentioned above has broken Android build.

@cra0zy

This comment has been minimized.

Copy link
Member

commented Jul 26, 2018

That build has merged some changes from @nkast . espacially some NullDeviceTests. May one of those Tests throws the Basic NullReferenceException?

No, no it has not, it was built against nkasts branch, not against develop branch. Build bot builds individuals PRs as well.

@MattiKloepper

This comment has been minimized.

Copy link
Author

commented Jul 26, 2018

Ah ok, sorry.
As you proposed I tested builds 1620 and 1614.

3.7.01614 works fine but 3.7.0.1620 throws the exception.

@cra0zy

This comment has been minimized.

Copy link
Member

commented Jul 26, 2018

Guessed as much, once I get home I'll look into it.

@cra0zy cra0zy self-assigned this Jul 27, 2018

@cra0zy

This comment has been minimized.

Copy link
Member

commented Jul 27, 2018

I have a fix for this locally, tho still need to fix one other thing before submitting.

cra0zy added a commit to cra0zy/MonoGame that referenced this issue Jul 28, 2018

@cra0zy

This comment has been minimized.

Copy link
Member

commented Jul 28, 2018

PR for fixing this is up.

cra0zy added a commit to cra0zy/MonoGame that referenced this issue Jul 28, 2018

@MattiKloepper

This comment has been minimized.

Copy link
Author

commented Jul 28, 2018

cra0zy added a commit to cra0zy/MonoGame that referenced this issue Jul 28, 2018

@cra0zy cra0zy closed this Jul 28, 2018

@MattiKloepper

This comment has been minimized.

Copy link
Author

commented Jul 30, 2018

Works fine for me now. Thanks a lot.

@nsnsns

This comment has been minimized.

Copy link

commented Aug 2, 2018

also, guys - it seems the 3.7.0.1625 build works ok on Lava Pixel V1 - using Pure Android (Android One) - while it crashes on Xiaomi Mi Max Prime which uses MiUI just as it crashes on @MattiKloepper Samsung Tab which uses TouchWiz UI.

However, I used the 3.7.0.1679 build from NuGet - and rebuilt project-- and it works perfect - both on device using AndroidOne and on Xiaomi MiMax Prime - which uses MiUI

Thanks a ton again @cra0zy - for all the useful comments and help- and thank you once again for all the work you are doing on NuGet! Much Appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.