Skip to content

Commit 4467dd2

Browse files
authored
Merge pull request #187 from winnerspiros/fix-android-trimming-csharp-18207883797666957787
Fix Android Release build error XACAS7023
2 parents df79756 + a097cc4 commit 4467dd2

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

osu.Android.props

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project>
1+
<Project>
22
<PropertyGroup>
33
<SupportedOSPlatformVersion>33.0</SupportedOSPlatformVersion>
44
<RuntimeIdentifiers>android-x86;android-arm;android-arm64</RuntimeIdentifiers>
@@ -13,10 +13,12 @@
1313
the patch in some build orderings. This suppression is harmless since we do fix them. -->
1414
<AndroidPageSize16KBCompatibilityCheck>false</AndroidPageSize16KBCompatibilityCheck>
1515
</PropertyGroup>
16+
1617
<!-- Patch NuGet-provided .so files that ship with 4 KB ELF alignment to 16 KB.
1718
See build/PatchElfPageSize.targets for details.
1819
TODO: Remove once ppy.Veldrid.SPIRV ships 16 KB-aligned native libraries. -->
1920
<Import Project="$(MSBuildThisFileDirectory)build\PatchElfPageSize.targets" />
21+
2022
<!-- Release-only optimisations: AOT for low-latency gameplay, trimming for smaller APK.
2123
Suppress trim analysis warnings because the project uses reflection extensively
2224
(Newtonsoft.Json, Realm, AutoMapper, RuntimeBinder). -->
@@ -29,6 +31,11 @@
2931
<AndroidLinkMode>None</AndroidLinkMode>
3032
<AndroidEnableResourceShrinking>false</AndroidEnableResourceShrinking>
3133
</PropertyGroup>
34+
35+
<ItemGroup Condition="'$(Configuration)' == 'Release'">
36+
<TrimmerRootAssembly Include="Microsoft.CSharp" />
37+
</ItemGroup>
38+
3239
<ItemGroup>
3340
<!-- IMPORTANT: ppy.osu.Framework.Android v2026.318.0 only ships net8.0-android34.0 assets.
3441
NuGet silently falls back to those assets when the app targets net10.0-android (API 36).
@@ -37,13 +44,14 @@
3744
TODO: Remove this comment once ppy.osu.Framework.Android ships net10.0-android assets. -->
3845
<PackageReference Include="ppy.osu.Framework.Android" Version="2026.318.0" />
3946
</ItemGroup>
47+
4048
<PropertyGroup>
4149
<!-- Fody does not handle Android build well, and warns when unchanged.
4250
Since Realm objects are not declared directly in Android projects, simply disable Fody. -->
4351
<DisableFody>true</DisableFody>
4452
</PropertyGroup>
4553

46-
<!-- Fix for .NET 10 Android AOT misclassifying non-managed assets in runtime pack.
54+
<!-- Fix for .NET 10 Android AOT misclassifying non-managed assets in runtime pack.
4755
This is critical for Android 16 (API 36) which has stricter manifest/parsing rules. -->
4856
<Target Name="FixRuntimePackAssetTypes" AfterTargets="ResolveRuntimePackAssets;ComputeFilesToPublish">
4957
<ItemGroup>

0 commit comments

Comments
 (0)