Today I created a Android phone game in project in Visual Studio Community 2022 Version 17.8.1. After the blank project was created I compiled the code and am now receiving these two error messages.
The workload ‘net6.0-android’ is out of support and will not receive security updates in the future. Please refer to .NET MAUI official support policy | .NET for more information about the support policy.
SupportedOSPlatformVersion 23 cannot be higher than TargetPlatformVersion 21.0. AndroidProjectMonoGame
I can’t figure out how to fix this issue. Note that I installed Monogame about 11 months ago, so I don’t know if I need to update my Monogame code.
I do have the latest version of Visual Studio. Anyway, can someone help me out please?
After the release of .net8 on september, the .net6 targets for ex-xamarin platforms (android, ios) got deprecated.
Open the .csproj and change targetframework from net6-android to net8-android.
Then open the manifest .xml and change the
minSdkFramework (or something similar) minSdkVersion
from 17,19 or whatever it was… to 21.
Wow, I appreciate the help. I made the changes, and now I am getting an error message about the Java SDK. Do I need to download and install it?
Here is the error message:
XA5300 The Java SDK directory could not be found. Install the Java SDK by by following the instructions at : "Setting up the Android SDK for Xamarin.Android - Xamarin | Microsoft Learn.
I don’t know about that.
Check if you have the ‘MAUI - Xamarin’ workload installed in VS22.
I don’t see it, should I install .NET Maui SDK for windows ?
I have it working now. Have a Happy Holiday, thanks so much !
Could you introduce your method in detail?I can no longer run the project aafter manually changing targetframework from net6.0-android to net8.0-android,and I can not find the “minSdkFramework” item in manifest.xml.
Wow,how did you work it out?I encountered the same problem but I spent days dealing with it and did not succeed.Thanks very much if you could give me your advice.
I wrote the first out of memory, because I was on a phone at the time, so I got some names wrong.
Here is a commit with the changes to upgrade the project to .net8.
In your .csproj file:
- replace ‘net6.0-android’ with ‘net8.0-android’ in “TargetFramework” tag.
- remove “SupportedOSPlatformVersion” tag. (or upgrade the value according to the error messages)
In your AndroidManifest.xml file:
- remove “uses-sdk” tag. (or upgrade the values of minSdkVersion and targetSdkVersion according to the error messages)
The default values of “SupportedOSPlatformVersion” and “uses-sdk” tags will do just fine for most cases and you don’t really need them. The app will be build with the least supported sdk version as minSdkVersion/SupportedOSPlatformVersion and the last installed sdk as the targetSdkVersion.
nkast,I appreciate the help. The emulator displays briefly then closes. See my screenshot. I removed the lines you suggested, in the diagram I drew a red line
threw them to show you the lines I deleted. Any ideas why the emulator is crashing? When you have time, thanks.
I’ve been failing to compile my game for about a week now.
Now it compiles correctly!
That also got rid of the errors for my Android project!
But now when I deploy to the emulator, nothing happens, VS Studio just says “Build succeeded” and the app is never transferred to the emulator?
Also if I plug in my Android device, it’s usually appears in the drop-down list, but does not anymore?
It’s worth mentioning I can open Android Studio and deploy all my old projects to my phone without trouble.