How to port a PC/Switch game to Android?

I was given a PC/Switch game to port for Android, but I can’t find any satisfatory material about how to do something like this. I’m not the original programmer of it, but I do have legal permission to do so, if you’re wondering

This game is using DesktopGL now, right?
The most important part is to swap the MonoGame.Framework.DesktopGL Nuget for the MonoGame.Framework.Android Nuget.

But there are a few more basics you need for Android. It’s best to create an empty Android project using the MonoGame extension, this will show you all the basic building blocks you need: Android manifest, main activity etc.

Then it’s just a case of fixing all the problems that occur.

1 Like

I changed it, (at least changed every “MonoGame.Framework.DesktopGL” to “MonoGame.Framework.Android”), made the empty android and changed the “game1” reference in activity into the game’s class, but now it just crashes

This sounds like you don’t really have much programming experience. You have to learn how to debug. What’s the exception message? Which line of code causes the crash?

I have some programming experience, but not with android or Visual Studio messing with dependencies and whatever occult configurations this project have. There’s nothing in the debug or terminal or anything like this, the only “exception message” is in the device log, no line is accused of the crash.

I’ve got this:

Time	Device Name	Type	PID	Tag	Message
11-08 21:50:04.066	pixel_5_-_api_32	Info	19553	MonoDroid	File name: '<Game Name>, Version=, Culture=neutral, PublicKeyToken=null'
   at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_(IntPtr jnienv, IntPtr native__this, IntPtr native_savedInstanceState)
   at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPL_V(_JniMarshal_PPL_V callback, IntPtr jnienv, IntPtr klazz, IntPtr p0)
	at crc64832cce6ad613a0ec.Activity1.n_onCreate(Native Method)
	at crc64832cce6ad613a0ec.Activity1.onCreate(
	at android.os.Handler.dispatchMessage(
	at android.os.Looper.loopOnce(
	at android.os.Looper.loop(
	at java.lang.reflect.Method.invoke(Native Method)

Did you launch in debug mode, directly from Visual Studio?
Do you have all the important settings in the csproj file, like they are in the template project?
Activity1.onCreate is where your game class gets created. If you really can’t get a proper exception in the debugger, then you’ll have to start outcommenting stuff, to find out what’s causing the problem.

I tried a lot of things and I noticed that it doesn’t find “Project Name.dll” and in fact there’s no such a file, only “Project Name.resources.dll” and “Project Name.exe”. How do I make this dll?

If you get a projectName.exe output than your project is configured for Windows. You need to fix that in the .csproj file (or open project settings in VS).