MonoGame icon indicating copy to clipboard operation
MonoGame copied to clipboard

Warning CA1416 when buildig for Android

Open AndreyFromGomel opened this issue 2 years ago • 2 comments

Hi, there is alot of CA1416 warnings in build log when I try to build my project for Android.

warning CA1416: This call site is reachable on: 'Android' 23.0 and later. 'XXX' is only supported on: 'Android' 31.0 and later. where 'XXX' is some entity from MonoGame like 'GamePadButtons.Back' or 'Game.Update(GameTime)'.

I think this happens because there is no <SupportedOSPlatformVersion>23</SupportedOSPlatformVersion> property in MonoGame.Framework.Android.csproj.

PS: Thank you fore releasing .Net 6 version, it is really cool.

What version of MonoGame does the bug occur on:

  • MonoGame 3.8.1.303

What operating system are you using:

  • macOS 12.4 ARM

What MonoGame platform are you using:

  • Android

AndreyFromGomel avatar Aug 02 '22 12:08 AndreyFromGomel

I did get those warnings and the upgrade-assistant didnt help at all while it worked fine on my other platforms. But its due thsi month for the android support, according to MSFT.

So for android I had to start the project file again from the new clean MG template, and it works for my game. but I think its a bit premature to try and perfect it under forms.
My game once deployed and running, seems faster more stable with the MG 3.81.. so i ignore the warnings u mentioned, plus i think i wont be using the view class much longer..

yes you have to shut off trimming , or parts won't be packaged.

Since Maui is supposed to be released, but only available tooling is command line or VS 2022 preview. i gave it a quick try... just a hello world..

Still slow as in over one minute to build and deploy, but xaml changes instantly reflect as you type in the emulator and previewer, and code changes work with hot reload. so it might be worth it.

I'm gonna leave mine as is for a while as this is in flux now. But according to MSFT , its 40% faster load , but it still uses Xamarin and i havent tried ARM on windows yet ..

. The summary of the roadmap its that its production ready, via command line, but not in vs 2022, but in the preview for the last few months already, still a WIP with progress due this month. thats my summary of this video. https://mybuild.microsoft.com/en-US/sessions/802e54dd-5b4a-460f-8e74-240e4a78f9c9 Maui doesn't target Linux do i dont plan to use it for Ui..i just use custom ui rendered with monogame. But, it targets quite alot so I might take a closer look as a way to deploy to desktops also, not sure how much I care about my linux version to be the same. sorry to be off topic but so much going on I dont want to take the wrong path.

damian-666 avatar Aug 03 '22 12:08 damian-666

this is painful.. i got mine working but not full screen as it did, and not hiding system UI as it did , I bump to min version 24, still get the warnings. but each change I try, is now 5 min to deploy, and i can't get IOnSystemUiVisibilityChangeListener to work like before (its says deprecated) and so can't hide the system UI like someone had shown earlier. there must be a new way... Also even with trimming off in the UI ,, i have to use AOT on debug, for some reason, i use plugins, but its probably saying to do trimming somewhere esle. then it works , fine but not taking the whole screen and no Hot reload of code.... I am just gonna commit the update , since it does run, and wait till its sorted out by msft.... stay with 3.81.. and focuson other platfroms.

Using windows, vs 2022 preview (last week, updating again today) , surface intel running emulator of a pixel 3xXL... on api 29..ill probably have to try a ton more things but is just too slow to work with for now so im leaving it for a while. I can do only this change with the new template, ScreenOrientation = ScreenOrientation.FullSensor and thats about it, mabye Maui is just must be easier even to use the full screen available Idont know.

damian-666 avatar Aug 03 '22 14:08 damian-666

I am experiencing the same issue as @AndreyFromGomel using Windows 10 / Visual Studio 2022.

What version of MonoGame does the bug occur on:

  • MonoGame 3.8.1.303 What operating system are you using:
  • Windows 10 x64 What MonoGame platform are you using:
  • Android

Brett208 avatar Aug 22 '22 00:08 Brett208

Same here. It happens even on an empty Android project you create with the VS extension. Any ideas?

espinosaluis avatar Aug 22 '22 21:08 espinosaluis

In my case the warnings I get are related to API 21.

warning CA1416: This call site is reachable on: 'Android' 21.0 and later. 'Vector2.Y' is only supported on: 'Android' 31.0 and later.

espinosaluis avatar Aug 24 '22 13:08 espinosaluis