Skip to content

fix(android): correct framework assembly names in Linker.xml to prevent startup crash - #320

Merged
winnerspiros merged 1 commit into
masterfrom
copilot/fix-osu-apk-crash-on-startup-again
May 8, 2026
Merged

fix(android): correct framework assembly names in Linker.xml to prevent startup crash#320
winnerspiros merged 1 commit into
masterfrom
copilot/fix-osu-apk-crash-on-startup-again

Conversation

Copilot AI commented May 8, 2026

Copy link
Copy Markdown

APK crashes on launch with NotSupportedException: Could not activate JNI Handle ... as managed type 'osu.Android.OsuGameActivity' because AndroidGameActivity's (IntPtr, JniHandleOwnership) JNI-activation constructor is stripped by ILLink.

Root cause

Linker.xml specified the framework assemblies by their NuGet package IDs, but ILLink's <assembly fullname="..."> matches against the CLR assembly name (<AssemblyName> in the csproj) — these are not the same:

Linker.xml had (wrong) Correct CLR assembly name
ppy.osu.Framework osu.Framework
ppy.osu.Framework.Android osu.Framework.Android

The mismatch meant ILLink stored the preserve="all" rules but never matched them against the assemblies in the link set. osu.Framework.Android was freely trimmed, stripping AndroidGameActivity's (IntPtr, JniHandleOwnership) constructor. On startup, the source-generated OsuGameActivity JNI constructor calls base(javaReference, transfer)MissingMethodException → wrapped as the observed NotSupportedException.

(ppy.Veldrid.SPIRV is unaffected — its package ID and assembly name are identical.)

Changes

  • osu.Android/Linker.xml — correct the two broken entries; expand comment to document the package-ID vs. assembly-name distinction explicitly so this mistake is not repeated
  • osu.Android/OsuGameActivity.cs — update stale comment that blamed the wrong root cause

…tartup crash

Agent-Logs-Url: https://github.com/winnerspiros/osu/sessions/b85fb8ac-4183-4adf-bd5c-eff96a2a7eb4

Co-authored-by: winnerspiros <1675249+winnerspiros@users.noreply.github.com>
@gitar-bot

gitar-bot Bot commented May 8, 2026

Copy link
Copy Markdown

Important

You are using the Gitar free plan. Upgrade to unlock code review, CI analysis, auto-apply, custom automations, and more.

Gitar

@winnerspiros
winnerspiros marked this pull request as ready for review May 8, 2026 23:53
Copilot AI review requested due to automatic review settings May 8, 2026 23:53
@winnerspiros
winnerspiros merged commit a79ad46 into master May 8, 2026
23 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes an Android startup crash caused by ILLink not applying Linker.xml preservation rules due to using NuGet package IDs instead of CLR assembly names for the osu-framework assemblies.

Changes:

  • Update osu.Android/Linker.xml to preserve osu.Framework and osu.Framework.Android using their CLR assembly names (and document the package-ID vs. assembly-name distinction).
  • Update an OsuGameActivity comment to reflect the correct crash root cause.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
osu.Android/OsuGameActivity.cs Updates a startup/orientation-related comment to point at the linker descriptor fix as the crash root cause.
osu.Android/Linker.xml Corrects framework <assembly fullname="..."> entries to match CLR assembly names so ILLink preservation applies.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants