Skip to content

Fix Android startup crash caused by JNI activation failure in trimmed builds - #166

Merged
winnerspiros merged 3 commits into
masterfrom
fix/android-jni-activation-crash-17469659687026419914
Apr 8, 2026
Merged

Fix Android startup crash caused by JNI activation failure in trimmed builds#166
winnerspiros merged 3 commits into
masterfrom
fix/android-jni-activation-crash-17469659687026419914

Conversation

@google-labs-jules

Copy link
Copy Markdown

Aggressive .NET trimming in .NET 10 was stripping the JNI activation constructor for OsuGameActivity, leading to a System.NotSupportedException on launch.

Changes:

  • Added explicit JNI constructor (IntPtr, JniHandleOwnership) to OsuGameActivity.
  • Migrated game and input handler initialization to the JNI constructor.
  • Added [UnconditionalSuppressMessage] to OsuGameActivity to silence trimmer warnings.
  • Updated Linker.xml to preserve all types in the osu.Android assembly.
  • Added Linker preservation for both possible AndroidGameActivity namespaces to ensure compatibility with framework versions.

PR created automatically by Jules for task 17469659687026419914 started by @winnerspiros

… builds

Aggressive .NET trimming in .NET 10 was stripping the JNI activation
constructor for OsuGameActivity, leading to a System.NotSupportedException
on launch.

Changes:
- Added explicit JNI constructor (IntPtr, JniHandleOwnership) to OsuGameActivity.
- Migrated game and input handler initialization to the JNI constructor.
- Added [UnconditionalSuppressMessage] to OsuGameActivity to silence trimmer warnings.
- Updated Linker.xml to preserve all types in the osu.Android assembly.
- Added Linker preservation for both possible AndroidGameActivity namespaces
  to ensure compatibility with framework versions.
@google-labs-jules

Copy link
Copy Markdown
Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

… builds

Aggressive .NET trimming in .NET 10 was stripping JNI registration
metadata for OsuGameActivity, leading to a System.NotSupportedException
on launch.

Changes:
- Added [UnconditionalSuppressMessage] to OsuGameActivity to silence trimmer warnings.
- Updated Linker.xml to preserve all types in the osu.Android assembly.
- Explicitly specified TrimmerRootDescriptor in osu.Android.csproj to ensure
  the .NET ILLink trimmer honors Linker.xml preservation for JNI activation.
- Added Linker preservation for both possible AndroidGameActivity namespaces
  to ensure compatibility with framework versions.
… builds

Aggressive .NET trimming in .NET 10 was stripping JNI registration
metadata for OsuGameActivity, leading to a System.NotSupportedException
on launch.

Changes:
- Added [UnconditionalSuppressMessage] to OsuGameActivity to silence trimmer warnings.
- Updated Linker.xml to preserve all types in the osu.Android assembly via wildcard.
- Explicitly specified TrimmerRootDescriptor in osu.Android.csproj to ensure
  the .NET ILLink trimmer honors Linker.xml preservation.
- Added Linker preservation for both possible AndroidGameActivity namespaces
  to ensure compatibility with framework versions.
@winnerspiros
winnerspiros merged commit 0617e99 into master Apr 8, 2026
7 of 17 checks passed
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.

1 participant