Trouble running MonoGame on Android IDE

Hi everyone,
I am trying to set up Monogame on the C# shell .net IDE app on Android and have hit a wall.
I couldn’t run the batch command or templates discussed in the set up page, but hoped I could get by with installing the Android platform Nugent package and writing the class to match that found in the template.
Unfortunately, when running I get the following error:
System.NullReferenceException: Object reference not set to an instance of an object at Microsoft.Xna.Framework.AndroidGamePlatform…ctor(Game game) at Microsoft.Xna.Framework.GamePlatform.PlatformCreate(Game game)
at Microsoft.Xna.Framework.Game…ctor()
at HelloWorld.Game1…ctor()
at HelloWorld.Program.Main(String[] args)
at System.Reflection.MethodInvoker.InterpretedInvoke(Object obj, Span`1 args, BindingFlags invokeAttr)

Any thoughts?
The debugger doesn’t allow me to explore the code where the error is thrown.

I had the same problem, and contacted the developer of the app and he said he will add support for MonoGame (or at least subset of it) in the future (here), so I recommend you to wait until that.
Also note that, developing games on android is not officially supported by MonoGame, so it might be hard to find any help regarding that.

You won’t be able to do that, since the C# Shell App is not running entire dotnet, but only the Roslyn C# compiler (aka Microsoft.CodeAnalysis)

1 Like

Developing games on android is officially supported by MonoGame, not sure what might have given that impression.

https://docs.monogame.net/articles/platforms.html#android

Thanks a bunch, KUNGERMOoN.
I will keep any eye on that, but it’s good to know it’s not doable for now.
The app is pretty cool as a way to code on commutes without a laptop, so I will just mess around making something that can run in a console window for now.
I’ll go subscribe to that forum you linked so I can grab that module if it drops.

1 Like

Aristurtle,
You’re right about deploying to Android, but I am talking about developing for Monogame via a C# IDE app on Android that I found: Coding on my phone.
KUNGERMOON was pointing out that the app didn’t support that yet.

Sorry, I didn’t phrase that correctly.
By developing on Android I meant “writing, compiling, building and running MonoGame code on Android device”, not “running games made with MonoGame on Android (compiled on some desktop device)”

1 Like

Also, as I said before, while the C# Shell App is very cool (although sometimes a bit buggy - not surprising considering how big it is) it isn’t simulating the entire .Net development ecosystem, but only the Roslyn part. Running said ecosystem inside a C# program on android would be an interesting challenge. The good thing about .Net is that it’s almost entirely written in, well, C# and .Net. The hard part would be integrating all the parts of the ecosystem together, as they are separate console apps and communicate by locating .exe files and running them, as opposed to doing something like making their code reference each other. For example, when you’re using Roslyn in your code, and want to execute the build process using MSBuild (for example using MSBuildWorkspace) the only supported way to do that is by finding the executable on your drive of the MSBuild installed on your machine. The obvious advantage of that is the fact that you can install parts of that ecosystem and separately use like the “normal” software. The problem is, however, that I believe this kind of communication wouldn’t work on Android at all. For that you would need to modify the source code of Roslyn, MSBuild, .Net SDK etc., which brings other problems, for example with trying to keep up with Microsoft speed of innovation, which no one except Microsoft manages to do (which is, to some part, the source of MonoGame’s indecisiveness when it comes to the future of consoles support).

Ah no worries, I see what you meant now, my apologies. The phrasing did catch me off guard :sweat_smile: just wanted to make sure anyone reading it didn’t see it as MonoGame doesn’t support android

1 Like