|
24 | 24 | <NoWarn>$(NoWarn);NU1608;XA4301</NoWarn> |
25 | 25 | </PropertyGroup> |
26 | 26 |
|
27 | | - <!-- Release-only optimisations: AOT for low-latency gameplay, trimming for smaller APK. |
28 | | - Suppress trim analysis warnings because the project uses reflection extensively |
29 | | - (Newtonsoft.Json, Realm, AutoMapper, RuntimeBinder). --> |
| 27 | + <!-- Release-only optimisations. |
| 28 | + Trimming and AOT were previously enabled here for size/startup, but caused a |
| 29 | + reproducible "splash → black screen → crash, no logs" failure on real devices. |
| 30 | + Root cause: PublishTrimmed + TrimMode=partial + AndroidEnableProfiledAot, with |
| 31 | + SuppressTrimAnalysisWarnings=true masking the build-time signal. Only Microsoft.CSharp |
| 32 | + and ppy.Veldrid.SPIRV were rooted — osu.Game, the rulesets, Realm, Newtonsoft.Json, |
| 33 | + AutoMapper, Sentry, OsuTK and other reflection-heavy assemblies were not. A trimmed |
| 34 | + method/type or an un-AOT'd profiled-AOT call site throws TypeLoadException / |
| 35 | + MissingMethodException early in OsuGame construction, before the file logger is open; |
| 36 | + the process dies on the SDLThread / .NET ThreadPool thread with only a tombstone, so |
| 37 | + the user gets no osu.log and Logcat shows a bare native crash. |
| 38 | + Upstream ppy/osu's osu.Android.props enables NEITHER trimming NOR AOT — we now match |
| 39 | + that baseline. The remaining release-only knobs (assembly compression, no PDBs) are |
| 40 | + safe and unrelated to the startup crash. To re-enable trimming/AOT in the future, |
| 41 | + reintroduce them one at a time, root every reflection-using assembly explicitly, and |
| 42 | + run with SuppressTrimAnalysisWarnings=false to surface the gaps before shipping. --> |
30 | 43 | <PropertyGroup Condition="'$(Configuration)' == 'Release'"> |
31 | | - <RunAOTCompilation>true</RunAOTCompilation> |
32 | | - <AndroidEnableProfiledAot>true</AndroidEnableProfiledAot> |
33 | | - <!-- Do NOT use EnableLLVM with profiled AOT on .NET 10. |
34 | | - The LLVM backend generates internally-inconsistent PLT (Procedure Linkage Table) |
35 | | - entries when only a subset of methods is AOT-compiled (profiled AOT). This causes |
36 | | - 'plt_entry not met' assertions in aot-runtime.c at startup (SIGABRT on SDLThread). |
37 | | - The default Mono AOT compiler handles partial-image PLT generation correctly. --> |
38 | | - <SuppressTrimAnalysisWarnings>true</SuppressTrimAnalysisWarnings> |
39 | | - <PublishTrimmed>true</PublishTrimmed> |
40 | | - <TrimMode>partial</TrimMode> |
41 | | - <!-- Keep IL bodies as a fallback for methods not covered by profiled AOT. |
42 | | - AndroidEnableProfiledAot only AOT-compiles methods in the startup profile; the remaining |
43 | | - methods require IL for JIT/interpretation. Stripping IL (AndroidStripILAfterAOT=true) |
44 | | - removes that fallback, causing 'plt_entry not met' assertions in aot-runtime.c when |
45 | | - the runtime encounters an un-AOT'd method (observed on .NET Timer thread at startup). |
46 | | - The ~20-30 MB size saving is not worth the crash risk. --> |
47 | | - <AndroidStripILAfterAOT>false</AndroidStripILAfterAOT> |
48 | 44 | <!-- Compress managed assemblies inside the APK (LZ4). Android extracts them on first run |
49 | 45 | but the download/APK size is significantly smaller. --> |
50 | 46 | <AndroidEnableAssemblyCompression>true</AndroidEnableAssemblyCompression> |
|
54 | 50 | <DebugSymbols>false</DebugSymbols> |
55 | 51 | </PropertyGroup> |
56 | 52 |
|
57 | | - <ItemGroup Condition="'$(Configuration)' == 'Release'"> |
58 | | - <!-- Force Microsoft.CSharp into the trimmer input graph (.NET 10+). --> |
59 | | - <!-- A bare TrimmerRootAssembly is ignored if the assembly is not in the --> |
60 | | - <!-- linker's input set; adding this reference ensures it is included. --> |
61 | | - <PackageReference Include="Microsoft.CSharp" Version="4.7.0" NoWarn="NU1510" /> |
62 | | - <TrimmerRootAssembly Include="Microsoft.CSharp" RootMode="all" /> |
63 | | - <!-- Preserve ppy.Veldrid.SPIRV from trimming. The trimmer does not trace the |
64 | | - CrossCompileTarget enum usage in osu.Framework's VeldridShader/GLShader correctly |
65 | | - (the reference crosses assembly boundaries via a ProjectReference chain), causing |
66 | | - TypeLoadException: 'Could not resolve type Veldrid.SPIRV.CrossCompileTarget' at |
67 | | - startup when the renderer tries to compile shaders. --> |
68 | | - <TrimmerRootAssembly Include="ppy.Veldrid.SPIRV" RootMode="all" /> |
69 | | - </ItemGroup> |
70 | | - |
71 | 53 | <ItemGroup> |
72 | 54 | <PackageReference Include="ppy.osu.Framework.Android" Version="2026.420.2" /> |
73 | 55 | <!-- `ppy.osu.Framework.NativeLibs` is a transitive dependency of `ppy.osu.Framework` |
|
0 commit comments