Skip to content

Conversation

@antonis
Copy link
Contributor

@antonis antonis commented Jan 27, 2026

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

Based on #5582

📜 Description

Implements Android E2E testing infrastructure to verify both manual native initialization and auto initialization from JavaScript, matching the iOS implementation and resolving issue #4912.

Key additions:

  • Jest configs for android.auto and android.manual test modes
  • Build scripts that toggle SENTRY_DISABLE_NATIVE_START at compile time
  • Test scripts to run auto and manual test suites separately
  • App start crash testing via flag file mechanism
  • TestControlModule to enable/disable crash-on-start from JS
  • Comprehensive E2E test documentation

Unlike iOS which uses launch arguments at runtime, Android requires separate builds with different build configurations to control native initialization.

💡 Motivation and Context

Fixes #4912

💚 How did you test it?

📝 Checklist

  • I added tests to verify changes
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • All tests passing
  • No breaking changes

🔮 Next steps

#skip-changelog

Implements Android E2E testing infrastructure to verify both manual native initialization and auto initialization from JavaScript, matching the iOS implementation and resolving issue #4912.

Key additions:
- Jest configs for android.auto and android.manual test modes
- Build scripts that toggle SENTRY_DISABLE_NATIVE_START at compile time
- Test scripts to run auto and manual test suites separately
- App start crash testing via flag file mechanism
- TestControlModule to enable/disable crash-on-start from JS
- Comprehensive E2E test documentation

Unlike iOS which uses launch arguments at runtime, Android requires separate builds with different build configurations to control native initialization.

Closes #4912

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@antonis antonis added the ready-to-merge Triggers the full CI test suite label Jan 27, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 27, 2026

Semver Impact of This PR

None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


This PR will not appear in the changelog.


🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 27, 2026

Android (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 431.13 ms 463.67 ms 32.53 ms
Size 43.75 MiB 48.40 MiB 4.65 MiB

Baseline results on branch: antonis/capture-app-start-errors-v8

Startup times

Revision Plain With Sentry Diff
b4df5a0+dirty 405.80 ms 412.56 ms 6.77 ms
88812b1+dirty 428.04 ms 462.22 ms 34.18 ms
82de722+dirty 425.13 ms 457.02 ms 31.89 ms

App size

Revision Plain With Sentry Diff
b4df5a0+dirty 43.75 MiB 48.40 MiB 4.65 MiB
88812b1+dirty 43.75 MiB 48.40 MiB 4.64 MiB
82de722+dirty 43.75 MiB 48.40 MiB 4.64 MiB

Previous results on branch: antonis/test-capture-app-start-errors-android

Startup times

Revision Plain With Sentry Diff
020ebf6+dirty 448.91 ms 477.16 ms 28.25 ms
b31244e+dirty 423.93 ms 460.20 ms 36.26 ms
1943112+dirty 408.73 ms 430.33 ms 21.60 ms

App size

Revision Plain With Sentry Diff
020ebf6+dirty 43.75 MiB 48.40 MiB 4.64 MiB
b31244e+dirty 43.75 MiB 48.40 MiB 4.65 MiB
1943112+dirty 43.75 MiB 48.40 MiB 4.64 MiB

@github-actions
Copy link
Contributor

github-actions bot commented Jan 27, 2026

Android (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 411.02 ms 451.28 ms 40.26 ms
Size 43.94 MiB 49.22 MiB 5.29 MiB

Baseline results on branch: antonis/capture-app-start-errors-v8

Startup times

Revision Plain With Sentry Diff
b4df5a0+dirty 364.57 ms 389.29 ms 24.71 ms
88812b1+dirty 425.90 ms 435.25 ms 9.35 ms
82de722+dirty 398.52 ms 422.70 ms 24.18 ms

App size

Revision Plain With Sentry Diff
b4df5a0+dirty 43.94 MiB 49.22 MiB 5.29 MiB
88812b1+dirty 43.94 MiB 49.22 MiB 5.29 MiB
82de722+dirty 43.94 MiB 49.22 MiB 5.29 MiB

Previous results on branch: antonis/test-capture-app-start-errors-android

Startup times

Revision Plain With Sentry Diff
020ebf6+dirty 403.26 ms 440.21 ms 36.95 ms
b31244e+dirty 373.67 ms 386.73 ms 13.06 ms
1943112+dirty 537.14 ms 566.29 ms 29.15 ms

App size

Revision Plain With Sentry Diff
020ebf6+dirty 43.94 MiB 49.22 MiB 5.29 MiB
b31244e+dirty 43.94 MiB 49.22 MiB 5.29 MiB
1943112+dirty 43.94 MiB 49.22 MiB 5.29 MiB

@github-actions
Copy link
Contributor

github-actions bot commented Jan 27, 2026

iOS (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1217.13 ms 1214.52 ms -2.60 ms
Size 3.38 MiB 4.67 MiB 1.29 MiB

Baseline results on branch: antonis/capture-app-start-errors-v8

Startup times

Revision Plain With Sentry Diff
88812b1+dirty 1216.63 ms 1215.55 ms -1.08 ms
82de722+dirty 1213.09 ms 1208.90 ms -4.19 ms
b4df5a0+dirty 1213.04 ms 1218.59 ms 5.55 ms

App size

Revision Plain With Sentry Diff
88812b1+dirty 3.38 MiB 4.67 MiB 1.29 MiB
82de722+dirty 3.38 MiB 4.67 MiB 1.29 MiB
b4df5a0+dirty 3.38 MiB 4.67 MiB 1.29 MiB

Previous results on branch: antonis/test-capture-app-start-errors-android

Startup times

Revision Plain With Sentry Diff
1943112+dirty 1210.58 ms 1199.85 ms -10.73 ms
020ebf6+dirty 1217.27 ms 1213.35 ms -3.92 ms
b31244e+dirty 1214.33 ms 1215.92 ms 1.58 ms

App size

Revision Plain With Sentry Diff
1943112+dirty 3.38 MiB 4.67 MiB 1.29 MiB
020ebf6+dirty 3.38 MiB 4.67 MiB 1.29 MiB
b31244e+dirty 3.38 MiB 4.67 MiB 1.29 MiB

@github-actions
Copy link
Contributor

github-actions bot commented Jan 27, 2026

iOS (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1210.89 ms 1210.04 ms -0.85 ms
Size 3.38 MiB 4.67 MiB 1.29 MiB

Baseline results on branch: antonis/capture-app-start-errors-v8

Startup times

Revision Plain With Sentry Diff
88812b1+dirty 1210.98 ms 1215.22 ms 4.24 ms
82de722+dirty 1210.87 ms 1217.00 ms 6.13 ms
b4df5a0+dirty 1217.06 ms 1221.61 ms 4.55 ms

App size

Revision Plain With Sentry Diff
88812b1+dirty 3.38 MiB 4.67 MiB 1.29 MiB
82de722+dirty 3.38 MiB 4.67 MiB 1.29 MiB
b4df5a0+dirty 3.38 MiB 4.67 MiB 1.29 MiB

Previous results on branch: antonis/test-capture-app-start-errors-android

Startup times

Revision Plain With Sentry Diff
1943112+dirty 1219.08 ms 1223.48 ms 4.40 ms
020ebf6+dirty 1214.02 ms 1217.34 ms 3.32 ms
b31244e+dirty 1214.18 ms 1214.19 ms 0.01 ms

App size

Revision Plain With Sentry Diff
1943112+dirty 3.38 MiB 4.67 MiB 1.29 MiB
020ebf6+dirty 3.38 MiB 4.67 MiB 1.29 MiB
b31244e+dirty 3.38 MiB 4.67 MiB 1.29 MiB

antonis and others added 4 commits January 27, 2026 11:42
The crash control buttons are off-screen, so the Maestro flow needs to
scroll to find them before tapping. This matches the pattern used in
other Android E2E tests.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The crash flag file was persisting across app launches, causing the app
to crash indefinitely. Now the flag auto-deletes when read, allowing:
1. First launch: Enable flag
2. Second launch: Read flag, delete it, then crash
3. Third launch: Start normally and send crash report

This solves the chicken-and-egg problem where the app couldn't reach
JavaScript to clear the flag because it kept crashing before JS loaded.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Android wraps exceptions thrown in Application.onCreate() with:
"Unable to create application... RuntimeException: <original message>"

Updated the test to check if ANY exception in the chain contains our
intentional crash message, rather than expecting an exact match on the
first exception.

Test now passes locally and should pass in CI.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@antonis
Copy link
Contributor Author

antonis commented Jan 27, 2026

@sentry review

@antonis
Copy link
Contributor Author

antonis commented Jan 27, 2026

@sentry review

@antonis antonis marked this pull request as ready for review January 27, 2026 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Triggers the full CI test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants