What to use for Target Framework and Minimum Framework for Android Maui project

Sumit Gupta 46 Reputation points
2024-05-17T11:24:36.0766667+00:00

User's image

When I select the Target Android Framework as available in dropdown (Android 14.0 API Level 34) it change the XML Tag in file as

<TargetFrameworks>net8.0-ios;net8.0-android34.0</TargetFrameworks>
	

But when I use same file to compile using Commant line it gives error as wrong framework is selected. However from within Visual studio it runs fine on emulator.

Why I need to compile from command line is because whatever settings I set when I try to make APK for review on real device (without using Visual studio as for client review in different country) I cannot get it working. With Xamarin I all the time create a RElease APK build and send to client and it works, but since we upgrade to Maui that doesn't seems like an option anymore. Command line as

dotnet publish <path> -f -c stuff seems working.

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,066 questions
0 comments No comments
{count} votes

Accepted answer
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 37,751 Reputation points Microsoft Vendor
    2024-05-20T02:47:50.67+00:00

    Hello,

    For specifying the Android SDK version, it is more recommended that you add this property to AndroidManifest.xml in a native way.

    <manifest xmlns:android="
    http://schemas.android.com/apk/res/android">
        <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="34" />
    </manifest>
    

    For issues where setting up directly in Visual Studio changes the .NET version, it is more recommended that you report the issue to the Visual Studio team. You could refer to Report a problem with the Visual Studio product or installer.

    Best Regards,

    Alec Liu.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful