Building MonoGame.Framework.Android from github sourcecode

I want to add a few Bluetooth methods directly to the base AndroidGameActivity class because I want to implement a direct phone to phone, “peer-to-peer” style video game.

I figured that the best way to do this (and was also told so on the Discord channel) would be to fork MonoGame from github and make my own modifications directly to the AndroidGameActivity.cs file and re-build from source.

So I’ve followed all of the instructions and all of the read-me’s, (git submodule update --init) and also the less well-specified dotnet workload install android that was needed due to targeting the Android flavor of .net6.0 specifically.

So all-in-all, I can open up Visual Studio 2022 and open the MonoGame.Framework.Android solution and I can build it. 201 Warnings and 0 Errors. Yay!

So shouldn’t this cause a MonoGame.Framework.Android.dll file to be created somewhere? Because I have scoured my PC’s filesystem up and down over and over again and built multiple times, but I cannot find the DLL file that I expected to have been produced by building this solution.

Am I doing something wrong or perhaps misunderstanding something?

I DO get a MonoGame.Framework.aar, a MonoGame.Framework.dll, a MonoGame.Framework.pdb, and a MonoGame.Framework.xml file. They’re located in my repos/MonoGame/Artifacts/MonoGame.Framework/Android folder.

However, I’ve created a blank Android Project, imported a standard Game1.cs and a standard Activity1.cs and linked this MonoGame.Framework.dll file as a dependency. However, when I try to run my new project, I get a null exception error on line 899 of MonoGame.Framework/Platform/Android//MonoGameAndroidGameView.cs which claims that _game does not have a graphicsDeviceManager.

I don’t know why this would be the case and all I can think of is that my MonoGame.Framework dll that I found should have been a MonoGame.Framework.Android dll file instead because that is what the Reference folder includes in a fresh, normal blank MonoGame.Android project.

I’m completely confused. If I want to use my custom version of MonoGame.Android with the added methods in the AndroidGameActivity.cs class, how am I even supposed to reference it?

When I make a new MonoGame.Android project from scratch, I CANNOT remove the standard MonoGame.Framework.Android reference from the references list. I cannot find a way, it does not seem to be possible. So how can I replace it with my own?

On the other hand, if I create a blank android project not related to Monogame directly and begin to simply import the dependencies that I need including the MonoGame.Framework dll that gets created when I build, then the game crashes in a file I haven’t touched.