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=1.175.0.0, 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(Activity1.java:29)
	at android.app.Activity.performCreate(Activity.java:8054)
	at android.app.Activity.performCreate(Activity.java:8034)
	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1341)
	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3666)
	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3842)
	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2252)
	at android.os.Handler.dispatchMessage(Handler.java:106)
	at android.os.Looper.loopOnce(Looper.java:201)
	at android.os.Looper.loop(Looper.java:288)
	at android.app.ActivityThread.main(ActivityThread.java:7842)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

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).