1.maui支持Android版本

This commit is contained in:
ShaoHua
2026-04-13 00:06:53 +08:00
parent d53828c150
commit d94d1f36d2
28 changed files with 609 additions and 72 deletions
+16 -6
View File
@@ -2,7 +2,8 @@
<PropertyGroup>
<TargetFrameworks>net10.0-android</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">net10.0-windows10.0.19041.0</TargetFrameworks>
<!-- 在 Windows 平台构建时,追加 Windows 目标框架,同时保留 Android,避免覆盖。 -->
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net10.0-windows10.0.19041.0</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('osx'))">$(TargetFrameworks);net10.0-ios;net10.0-maccatalyst</TargetFrameworks>
<!-- Note for MacCatalyst:
@@ -48,6 +49,7 @@
<TodoWebDistDir>$(TodoWebDir)\dist</TodoWebDistDir>
<SkipWebBuild>false</SkipWebBuild>
<ForceWebBuild>false</ForceWebBuild>
<ForceFullAndroidDeploy>false</ForceFullAndroidDeploy>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">
@@ -64,12 +66,19 @@
<Optimize>False</Optimize>
<EnableMauiImageProcessing>false</EnableMauiImageProcessing>
<DisableResizetizer>true</DisableResizetizer>
<!-- Android 调试默认跳过前端构建,减少每次 F5 等待时间。 -->
<SkipWebBuild>true</SkipWebBuild>
<AndroidPackageFormat>apk</AndroidPackageFormat>
<AndroidCreatePackagePerAbi>False</AndroidCreatePackagePerAbi>
<AndroidUseSharedRuntime>True</AndroidUseSharedRuntime>
<AndroidEnableFastDeployment>True</AndroidEnableFastDeployment>
<AndroidFastDeploymentType>Assemblies</AndroidFastDeploymentType>
<EmbedAssembliesIntoApk>False</EmbedAssembliesIntoApk>
<!-- 默认启用 Fast Deployment,加速日常 C#/XAML 调试。 -->
<AndroidUseSharedRuntime Condition="'$(ForceFullAndroidDeploy)' != 'true'">True</AndroidUseSharedRuntime>
<AndroidEnableFastDeployment Condition="'$(ForceFullAndroidDeploy)' != 'true'">True</AndroidEnableFastDeployment>
<AndroidFastDeploymentType Condition="'$(ForceFullAndroidDeploy)' != 'true'">Assemblies</AndroidFastDeploymentType>
<EmbedAssembliesIntoApk Condition="'$(ForceFullAndroidDeploy)' != 'true'">False</EmbedAssembliesIntoApk>
<!-- 需要验证 Android 资源变更时,传入 -p:ForceFullAndroidDeploy=true。 -->
<AndroidUseSharedRuntime Condition="'$(ForceFullAndroidDeploy)' == 'true'">False</AndroidUseSharedRuntime>
<AndroidEnableFastDeployment Condition="'$(ForceFullAndroidDeploy)' == 'true'">False</AndroidEnableFastDeployment>
<EmbedAssembliesIntoApk Condition="'$(ForceFullAndroidDeploy)' == 'true'">True</EmbedAssembliesIntoApk>
<AndroidSupportedAbis>x86_64</AndroidSupportedAbis>
<UseAppHost>false</UseAppHost>
</PropertyGroup>
@@ -91,7 +100,7 @@
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#F8FAFC" BaseSize="128,128" />
<!-- Images -->
<MauiImage Include="Resources\Images\*" />
@@ -120,6 +129,7 @@
<ItemGroup>
<EmbeddedResource Include="icon.ico" />
<EmbeddedResource Include="Platforms\Android\Resources\drawable\icon.ico" />
</ItemGroup>
<ItemGroup>