Repository navigation
feat: support for unity as a library on Android - #2895
Merged
Merged
Conversation
Contributor
|
…in the host's trace
… app's exits aren't reported twice
…game's own process instead of sentry-java's defaults
…e's own process is detected there
…IDs skip the bridge call
… trace when a read comes up empty
…java can't sync the environment
…cribe the release, environment and ANR handling
…app's SDK can't see other processes' exits
… in the game's own Android process
bitsandfoxes
marked this pull request as ready for review
October 28, 2026 11:35
bitsandfoxes
requested review from
a team,
jpnurmi,
limbonaut and
tustanivsky
October 28, 2026 11:35
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit cac9cef. Configure here.
mujacica
approved these changes
Oct 29, 2026
jpnurmi
reviewed
Oct 29, 2026
jpnurmi
approved these changes
Oct 29, 2026
3 tasks
This was referenced Oct 30, 2026
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Adds experimental support for Unity as a Library on Android, on top of the iOS support in #2885. A native Android app that embeds the game and already ships sentry-android gets the game's errors, crashes and logs in the same release, environment, user and trace as its own, without bundling a second SDK.
Set
AndroidNativeInitializationType = NativeInitializationType.Externalin the Unity options. The app depends onio.sentry:sentry-android8.49.0 or newer and starts it as usual. Nothing else is needed in the app.How it works:
io.sentry.*manifest entries:unityLibrary's manifest merges into the app's, and today'sio.sentry.auto-init=falsewould turn off an app that relies on auto-init. The ProGuard rules stay as consumer rules, so the app's R8 keeps the classes the game calls by name.android:process=":Unity", as in Unity's UaaL sample), the app's SDK doesn't exist there. The game starts sentry-android itself with the options set in Unity, and it:cache/sentry-<process>), so it doesn't end the app's session or overwrite its persisted scope;cache/sentry/<dsn hash>/.options-cache,.scope-cache), at start and on every resume. A release or environment the game sets itself wins, in the options or through the Editor's override fields, even when it matches the default (as on iOS). A file it can't read, e.g. while the app's SDK rewrites it, keeps the previous trace and user;unityLibrary/build.gradleand runs aftermerge<Variant>JniLibFolders, since the app never buildslauncher.Verified on a Pixel 6 (Android 16) with a host app on sentry-android 8.59.0, in both layouts:
LogError, caught and unhandled exceptions, logsNativeButtons.cs:53), app's user and traceunitycontext, same traceunload()and show againKnown limits:
SentrySdk.StartTransaction(name, op)joins the app's trace (as on iOS).Utils.ForceCrashcalled from a one-line method has no C# frame: IL2CPP compiles it to a tail call.Sentry.Unity.Android.dllnow loads in the Editor inpackage-dev, asSentry.Unity.iOS.dlldoes, soSentry.Unity.Android.Testsruns in the Editor test runs. The release package still ships it for Android only.Builds on #2885, which is merged into
main. The CHANGELOG has one entry for both platforms. #2885 added it for iOS, and this PR extends it to Android.Part of #2416.
🤖 Generated with Claude Code