Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions osu.Android/OsuGameActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@
// The explicit SDL3-CS attribute roots SDLActivity(IntPtr, JniHandleOwnership) — the actual
// overload TypeManager.Activate calls — which has NO managed call-graph path and would
// otherwise be silently trimmed even if the parameterless constructor chain is preserved.
// See also the OsuGameActivity(IntPtr, JniHandleOwnership) constructor below, which is the
// direct fix for the v2026.509.229 crash: TypeManager.Activate needs this on the concrete type.
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors,
"osu.Framework.Android.AndroidGameActivity", "osu.Framework.Android")]
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors,
Expand All @@ -107,6 +109,19 @@
game = new OsuGameAndroid(this);
}

// Required JNI activation constructor. TypeManager.Activate performs a reflection
// lookup for (IntPtr, JniHandleOwnership) on the *concrete* managed type when Android
// re-instantiates this Activity from a JNI handle (process death/recreation, back-stack
// restore). Inheriting this constructor from AndroidGameActivity/SDLActivity is not
// sufficient — .NET Android's TypeManager resolves it via GetConstructor on the concrete
// type; if the method is absent there the lookup falls through and Activate throws
// NotSupportedException ("Could not activate JNI Handle ... as managed type
// 'osu.Android.OsuGameActivity'"), which is the crash seen in v2026.509.229.
protected OsuGameActivity(IntPtr javaReference, JniHandleOwnership transfer)
: base(javaReference, transfer)

Check failure on line 121 in osu.Android/OsuGameActivity.cs

View workflow job for this annotation

GitHub Actions / Build only (Android)

'AndroidGameActivity' does not contain a constructor that takes 2 arguments

Check failure on line 121 in osu.Android/OsuGameActivity.cs

View workflow job for this annotation

GitHub Actions / Build only (Android)

'AndroidGameActivity' does not contain a constructor that takes 2 arguments

Check failure on line 121 in osu.Android/OsuGameActivity.cs

View workflow job for this annotation

GitHub Actions / Build only (Android)

'AndroidGameActivity' does not contain a constructor that takes 2 arguments

Check failure on line 121 in osu.Android/OsuGameActivity.cs

View workflow job for this annotation

GitHub Actions / Build only (Android)

'AndroidGameActivity' does not contain a constructor that takes 2 arguments
{
}

protected override void OnCreate(Bundle? savedInstanceState)
{
// NOTE: do NOT assign RequestedOrientation here. The `[Activity]` attribute on this
Expand Down
Loading