dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.26k stars 1.76k forks source link

.NET MAUI 9 does not support Android 14.0 (API 34) #25898

Open SorenBech2 opened 5 days ago

SorenBech2 commented 5 days ago

Description

Creating a new .net MAUI 9 app using Visual Studio 17.12.0 through File > New > Project (updating nuget packages to latest version 9.0.10)

and subsequently selecting the target android framework through:
Project > Properties > Application > Android Targets

Selecting Android 14.0 renders an entry in the .csproj file as per below: \<TargetFrameworks>net9.0-ios;net9.0-maccatalyst;net9.0-android34.0\</TargetFrameworks>

When trying to build the app to a Android 14.0 device (Samsung) below error message is received: Error (active) NETSDK1140 34.0 is not a valid TargetPlatformVersion for Android. Valid versions include: 35.0 MauiApp1 (net9.0-android34.0) C:\Program Files\dotnet\sdk\9.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets 259

If the API version is removed from the .csproj file \<TargetFrameworks>net9.0-ios;net9.0-maccatalyst;net9.0-android\</TargetFrameworks>

the following error displays when trying to build (release configuration): The project cannot be launched for Android. Please chech the error log for more details.

If trying to build/deploy in debug configuration, the app builds and crashes while displaying flash screen with no error messages at all.

(For description including screen shots see attached documentdotnet 9 maui does not support Android14.docx

Steps to Reproduce

See description above

Link to public reproduction project repository

No response

Version with bug

9.0.10 SR1

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

8.0.100

Affected platforms

Android

Affected platform versions

Android 14

Did you find any workaround?

No response

Relevant log output

jfversluis commented 5 days ago

Unless I'm mistaken you can't target API 34 with Android on .NET 9 (and thus .NET MAUI on .NET 9) @jonathanpeppers ?

Also see: https://github.com/dotnet/maui/issues/24260#issuecomment-2291695989

So the only issue I see here is that you're actually able to select 34 through Visual Studio. Unfortunately, that is something that is outside of the scope of this repository and we have no great way of moving tickets between these systems. I'll add a label on here with instructions on how to report it to Visual Studio so that it lands with the right team.

SorenBech2 commented 5 days ago

Hi Gerald et all

I hope that your assumption, that Android API 34 cannot be targeted on .NET 9 is not true. It seems a bit premature to skip API 34 just yet, as Samsung does not ship API 35 until 2025 . There is no specific dates for when Android 15 is available on all Samsung devices - meaning it could be well into 2025 before .NET 9 then becomes relevant to businesses that are developing mobile apps. Samsung being the largest suppler of mobile devices ensuring a mobile app runs on Samsung devices is paramount. If your assumption is true, then .NET 9 is more or less irrelecant as .NET 10 would then be the version to go fore. This could be a solution, if it wasn’t for the case, that .NET 8 MAUI has so many issue and .NET 9 hopefully should bring (much) more robustness to MAUI. Please confirm/reject, that your assumption holds.


From: Gerald Versluis @.> Sent: Saturday, November 16, 2024 12:53 PM To: dotnet/maui @.> Cc: Søren Bech @.>; Author @.> Subject: Re: [dotnet/maui] .NET MAUI 9 does not support Android 14.0 (API 34) (Issue #25898)

Unless I'm mistaken you can't target API 34 with Android on .NET 9 (and thus .NET MAUI on .NET 9) @jonathanpeppershttps://github.com/jonathanpeppers ?

Also see: #24260 (comment)https://github.com/dotnet/maui/issues/24260#issuecomment-2291695989

So the only issue I see here is that you're actually able to select 34 through Visual Studio. Unfortunately, that is something that is outside of the scope of this repository and we have no great way of moving tickets between these systems. I'll add a label on here with instructions on how to report it to Visual Studio so that it lands with the right team.

— Reply to this email directly, view it on GitHubhttps://github.com/dotnet/maui/issues/25898#issuecomment-2480535308, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A2Y4YKRI6ZJHGXP27JWD7RT2A4W2DAVCNFSM6AAAAABR4RZHKCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIOBQGUZTKMZQHA. You are receiving this because you authored the thread.

AlleSchonWeg commented 5 days ago

Perhaps this issue could help: https://github.com/dotnet/android/issues/8331 (It explains it for .Net 8. But 9 should be analog)

But with target API 35 (.Net 9) you can install your app on devices lower than 35. SupportedOSPlatformVersion controls the android:minSdkVersion. If you set this to 27 for example you can install your app on devices >= API 27 If you receive a crash you could look at the logcat for expample.

jonathanpeppers commented 3 days ago

@SorenBech2 I think you are maybe misunderstanding the behavior. What is your actual problem? What are you trying to do?

.NET 9:

It is pretty reasonable for apps to target 35 with a min of 21.

dotnet-policy-service[bot] commented 3 days ago

Hi @SorenBech2. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

jonathanpeppers commented 3 days ago

If trying to build/deploy in debug configuration, the app builds and crashes while displaying flash screen with no error messages at all.

If this is the actual problem, it's probably unrelated to targeting 35. The crash and error message should be visible in adb logcat.