Skip to content

Conversation

@krystofwoldrich
Copy link
Contributor

This PR adds package scripts for the matrix of builds we support with our sample app, which makes it simpler to build and test different versions of the app.

Example usage:

yarn pod-install-debug-static

yarn set-test-dsn-ios
yarn build-ios-debug
yarn test-ios

yarn set-test-dsn-android
yarn build-android-debug
yarn test-android

#skip-changelog

@github-actions
Copy link
Contributor

github-actions bot commented Feb 18, 2025

Android (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 343.90 ms 357.45 ms 13.55 ms
Size 17.75 MiB 20.11 MiB 2.36 MiB

Baseline results on branch: capture-app-start-errors

Startup times

Revision Plain With Sentry Diff
1a89392 412.59 ms 424.69 ms 12.10 ms
18a5066 427.89 ms 436.47 ms 8.57 ms
b6d933c 442.52 ms 461.82 ms 19.30 ms
208f4af 439.23 ms 427.31 ms -11.92 ms
5625ce7 476.74 ms 488.24 ms 11.50 ms
b75148e 440.04 ms 421.36 ms -18.68 ms
555070f 438.67 ms 428.30 ms -10.37 ms
454f971 436.27 ms 478.76 ms 42.48 ms

App size

Revision Plain With Sentry Diff
1a89392 17.75 MiB 20.11 MiB 2.37 MiB
18a5066 17.75 MiB 20.11 MiB 2.37 MiB
b6d933c 17.75 MiB 20.11 MiB 2.37 MiB
208f4af 17.75 MiB 20.11 MiB 2.37 MiB
5625ce7 17.75 MiB 20.11 MiB 2.37 MiB
b75148e 17.75 MiB 20.11 MiB 2.37 MiB
555070f 17.75 MiB 20.11 MiB 2.37 MiB
454f971 17.75 MiB 20.11 MiB 2.37 MiB

Previous results on branch: kw-simplify-local-sample-testing

Startup times

Revision Plain With Sentry Diff
29e6f61 464.30 ms 487.35 ms 23.04 ms
7430ff6 408.00 ms 453.50 ms 45.50 ms
937f6e2 355.20 ms 377.10 ms 21.90 ms

App size

Revision Plain With Sentry Diff
29e6f61 17.75 MiB 20.11 MiB 2.37 MiB
7430ff6 17.75 MiB 20.11 MiB 2.37 MiB
937f6e2 17.75 MiB 20.11 MiB 2.37 MiB

@github-actions
Copy link
Contributor

github-actions bot commented Feb 18, 2025

Android (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 426.66 ms 464.02 ms 37.36 ms
Size 7.15 MiB 8.38 MiB 1.23 MiB

Baseline results on branch: capture-app-start-errors

Startup times

Revision Plain With Sentry Diff
5625ce7+dirty 358.15 ms 416.65 ms 58.50 ms
b6d933c+dirty 398.43 ms 456.62 ms 58.19 ms
8d0daf6+dirty 393.58 ms 394.84 ms 1.26 ms
18a5066+dirty 370.06 ms 414.10 ms 44.04 ms
1a89392+dirty 425.56 ms 530.65 ms 105.09 ms
b75148e+dirty 428.91 ms 461.26 ms 32.35 ms
454f971+dirty 439.04 ms 423.88 ms -15.16 ms
208f4af+dirty 346.93 ms 402.77 ms 55.84 ms
555070f+dirty 388.25 ms 424.44 ms 36.19 ms

App size

Revision Plain With Sentry Diff
5625ce7+dirty 7.15 MiB 8.38 MiB 1.23 MiB
b6d933c+dirty 7.15 MiB 8.38 MiB 1.23 MiB
8d0daf6+dirty 7.15 MiB 8.38 MiB 1.23 MiB
18a5066+dirty 7.15 MiB 8.38 MiB 1.23 MiB
1a89392+dirty 7.15 MiB 8.38 MiB 1.23 MiB
b75148e+dirty 7.15 MiB 8.38 MiB 1.23 MiB
454f971+dirty 7.15 MiB 8.38 MiB 1.23 MiB
208f4af+dirty 7.15 MiB 8.38 MiB 1.23 MiB
555070f+dirty 7.15 MiB 8.38 MiB 1.23 MiB

Previous results on branch: kw-simplify-local-sample-testing

Startup times

Revision Plain With Sentry Diff
29e6f61+dirty 394.80 ms 386.78 ms -8.02 ms
937f6e2+dirty 397.14 ms 420.40 ms 23.26 ms
7430ff6+dirty 351.51 ms 353.67 ms 2.16 ms

App size

Revision Plain With Sentry Diff
29e6f61+dirty 7.15 MiB 8.38 MiB 1.23 MiB
937f6e2+dirty 7.15 MiB 8.38 MiB 1.23 MiB
7430ff6+dirty 7.15 MiB 8.38 MiB 1.23 MiB

@github-actions
Copy link
Contributor

github-actions bot commented Feb 18, 2025

iOS (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1229.94 ms 1232.40 ms 2.46 ms
Size 2.63 MiB 3.74 MiB 1.11 MiB

Baseline results on branch: capture-app-start-errors

Startup times

Revision Plain With Sentry Diff
555070f+dirty 1213.59 ms 1217.79 ms 4.20 ms
b6d933c+dirty 1217.71 ms 1220.58 ms 2.87 ms
b75148e+dirty 1221.53 ms 1220.85 ms -0.68 ms
454f971+dirty 1220.55 ms 1225.82 ms 5.27 ms
8d0daf6+dirty 1230.90 ms 1233.16 ms 2.27 ms
208f4af+dirty 1209.44 ms 1217.13 ms 7.70 ms
18a5066+dirty 1218.00 ms 1212.27 ms -5.73 ms
5625ce7+dirty 1226.98 ms 1217.77 ms -9.21 ms
1a89392+dirty 1220.12 ms 1216.69 ms -3.43 ms

App size

Revision Plain With Sentry Diff
555070f+dirty 2.63 MiB 3.69 MiB 1.05 MiB
b6d933c+dirty 2.63 MiB 3.70 MiB 1.06 MiB
b75148e+dirty 2.63 MiB 3.69 MiB 1.06 MiB
454f971+dirty 2.63 MiB 3.74 MiB 1.11 MiB
8d0daf6+dirty 2.63 MiB 3.74 MiB 1.11 MiB
208f4af+dirty 2.63 MiB 3.69 MiB 1.05 MiB
18a5066+dirty 2.63 MiB 3.70 MiB 1.06 MiB
5625ce7+dirty 2.63 MiB 3.70 MiB 1.06 MiB
1a89392+dirty 2.63 MiB 3.70 MiB 1.06 MiB

Previous results on branch: kw-simplify-local-sample-testing

Startup times

Revision Plain With Sentry Diff
29e6f61+dirty 1216.02 ms 1228.84 ms 12.82 ms
937f6e2+dirty 1221.29 ms 1222.53 ms 1.24 ms
7430ff6+dirty 1228.63 ms 1240.98 ms 12.35 ms

App size

Revision Plain With Sentry Diff
29e6f61+dirty 2.63 MiB 3.74 MiB 1.11 MiB
937f6e2+dirty 2.63 MiB 3.74 MiB 1.11 MiB
7430ff6+dirty 2.63 MiB 3.74 MiB 1.11 MiB

@github-actions
Copy link
Contributor

github-actions bot commented Feb 18, 2025

iOS (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1208.11 ms 1219.86 ms 11.75 ms
Size 3.19 MiB 4.30 MiB 1.12 MiB

Baseline results on branch: capture-app-start-errors

Startup times

Revision Plain With Sentry Diff
555070f+dirty 1223.61 ms 1227.57 ms 3.96 ms
b6d933c+dirty 1228.02 ms 1235.32 ms 7.30 ms
b75148e+dirty 1202.72 ms 1212.04 ms 9.32 ms
454f971+dirty 1233.51 ms 1239.18 ms 5.67 ms
8d0daf6+dirty 1227.80 ms 1236.83 ms 9.03 ms
208f4af+dirty 1213.08 ms 1223.82 ms 10.73 ms
18a5066+dirty 1244.20 ms 1251.54 ms 7.34 ms
5625ce7+dirty 1219.73 ms 1223.80 ms 4.07 ms
1a89392+dirty 1229.00 ms 1234.78 ms 5.78 ms

App size

Revision Plain With Sentry Diff
555070f+dirty 3.19 MiB 4.25 MiB 1.06 MiB
b6d933c+dirty 3.19 MiB 4.26 MiB 1.08 MiB
b75148e+dirty 3.19 MiB 4.25 MiB 1.07 MiB
454f971+dirty 3.19 MiB 4.31 MiB 1.12 MiB
8d0daf6+dirty 3.19 MiB 4.30 MiB 1.12 MiB
208f4af+dirty 3.19 MiB 4.25 MiB 1.06 MiB
18a5066+dirty 3.19 MiB 4.26 MiB 1.08 MiB
5625ce7+dirty 3.19 MiB 4.26 MiB 1.08 MiB
1a89392+dirty 3.19 MiB 4.26 MiB 1.08 MiB

Previous results on branch: kw-simplify-local-sample-testing

Startup times

Revision Plain With Sentry Diff
29e6f61+dirty 1229.31 ms 1235.08 ms 5.78 ms
937f6e2+dirty 1227.73 ms 1218.65 ms -9.08 ms
7430ff6+dirty 1223.08 ms 1219.17 ms -3.91 ms

App size

Revision Plain With Sentry Diff
29e6f61+dirty 3.19 MiB 4.31 MiB 1.12 MiB
937f6e2+dirty 3.19 MiB 4.31 MiB 1.12 MiB
7430ff6+dirty 3.19 MiB 4.31 MiB 1.12 MiB

@krystofwoldrich krystofwoldrich changed the base branch from capture-app-start-errors to kw-fix-bad-merge February 19, 2025 10:11
Base automatically changed from kw-fix-bad-merge to capture-app-start-errors February 20, 2025 09:04
@antonis
Copy link
Contributor

antonis commented Feb 20, 2025

Thank you for this enhancement @krystofwoldrich 🙇

The PR looks great and the scripts worked as expected in my tests. I left a nitpick pick but feel free to ignore since I might be the only one using those scripts 😅
We could also update the contributor's guide sample section with the changes and the new scripts.

I think the Test ios production failure is due to the way the downloaded archive is unzipped. The sentry-react-native-sample.app.zip seems to be unzipped to a folder. Probably just copying to sentry-react-native-sample.app with ditto could work 🤞

Copy link
Contributor

@antonis antonis left a comment

Choose a reason for hiding this comment

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

LGTM 🚀
Thank you for this enhancement Krystof 🙇

@krystofwoldrich krystofwoldrich merged commit e935360 into capture-app-start-errors Feb 21, 2025
68 checks passed
@krystofwoldrich krystofwoldrich deleted the kw-simplify-local-sample-testing branch February 21, 2025 07:29
antonis added a commit that referenced this pull request Jan 29, 2026
* ref(ios): Extract Cocoa SDK init into standalone file (#4442)

* ref(android): Extracts Android native initialization to standalone structures (#4445)

* Extract Android SDK Init

* Update tests

* Adds changelog

* Fix lint issues

* Rename RNSentryStart instance for clarity

* Converts RNSentryStart to utility class

* Update CHANGELOG.md

---------

Co-authored-by: Krystof Woldrich <31292499+krystofwoldrich@users.noreply.github.com>

* feat(experimental): Add native `startWithConfigureOptions` for Apple platforms (#4444)

* feat: Read `sentry.options.json` during cocoa init (#4447)

* Adds utility class for converting `JsonObject` to `WritableMap` (#4479)

* Convert json object to writable map

* Make class/methods package-private(default)

* feat: Automatically load `sentry.options.json` file (#4476)

* feat(experimental): Initialize Android SDK from json configuration (#4451)

* misc: Add `sentry.options.json` example to the changelog (#4509)

* feat(init): Load options from `sentry.options.json` in JS (#4510)

* release: 6.7.0-alpha.0

* misc(sample): Change RN Sample to use native file init by default (#4522)

* chore(sample-rn): Remove duplicate init options from code (#4532)

* chore(sample-rn): Always use fhe file option (including auto init) (#4533)

* internal(sample-rn): Add Detox for integration/e2e tests of the rn sample (#4535)

* internal(sample-rn): Add header and message envelope tests (#4536)

* fix(sample-e2e): Fix type errors missing sentry/core and afterAll (#4564)

* chore(samples): Add package scripts for native builds, dsn and testing (#4561)

* test(e2e): Verify captured Errors Screen transaction (#4584)

* test(e2e): Add auto init from JS tests (#4588)

* test(e2e): Add app start crash test for iOS (#4593)

* test(e2e): Avoid race conditions when waiting for captured message (#4595)

* chore(sample-e2e): Move Detox related files to e2e-detox dir

* fix: remove unused SentryPackage import

Removed unused import that was causing CI lint failure

* fix: update RNSentryStartTest for Sentry Android SDK v7 API changes

- Removed assertions for packages getter (not available in v7)
- Removed assertion for enableTracing property (removed in v7)
- Added comments explaining the API changes

* fix: remove unused addPackages method to fix PMD lint error

The method was a no-op after v7 API changes, so removing it entirely
to avoid unused parameter warnings from PMD.

* fix: update RNSentrySDKTest for Sentry Android SDK v7 API changes

- Removed assertions for enableTracing property (removed in v7)
- Removed assertions for packages getter (not available in v7)
- Added comments explaining the API changes

* fix: use relative path for RNSentrySDK+Test.h import in bridging header

The file is in the parent directory, so use ../ prefix to fix the import path

* fix: remove deprecated enableTracing property in iOS RNSentryStart

The property is deprecated in v7. Tracing is already disabled by setting
tracesSampleRate and tracesSampler to nil.

* fix: remove enableTracing assertions from iOS tests

The enableTracing property is deprecated in Sentry Cocoa SDK v7.
Tracing is already verified to be disabled by checking that
tracesSampleRate and tracesSampler are nil.

* Update Podspec

* Fix lint issue

* ref(sample-e2e): v7: Migrate from Detox to Maestro (#5473)

* chore(sample-e2e): Migrate from Detox to Maestro

* fix set dsn script path

* fix: Update script paths after detox-to-maestro migration

The set-dsn scripts were moved from scripts/detox/ to scripts/ during the migration

* Update script paths

* Fix tests

* Fix test failure

* Fix idle issue

* fix(e2e): Fix Maestro flows for captureMessage and captureSpaceflightNewsScreen

- Add scrollUntilVisible for 'Capture message' button (might be off-screen)
- Add proper waiting and scrolling for SpaceflightNewsScreen to trigger auto-load
- Wait for 'Load More Articles' button to appear after autoLoadCount threshold

* chore(e2e-sample): Increase Maestro driver startup timeout

(cherry picked from commit ee429b5)

* increase timeout

* Increase timeouts on Android too

---------

Co-authored-by: Krystof Woldrich <krystof.woldrich@sentry.io>

* chore: Merge Android UI profiling on the capture startup crashes branch (#5544)

* chore: Merge Android UI profiling on the capture startup crashes branch

* Fix logger compilation issue

* Properly check logging values

* fix SR iOS issue (#5560)

* Remove duplicate changelog entry

* feat(expo): Add RNSentrySDK APIs support to @sentry/react-native/expo plugin (#4633)

* useNativeInit Android implementation

* Adds changelog

* useNativeInit iOS implementation

* Fix indentation

* Extend test cases with realistic data

* Adds code sample in the changelog

* Fix CHANGELOG.md

Co-authored-by: LucasZF <lucas-zimerman1@hotmail.com>

* Warn if RESentySDK.init/start wasn't injected

* Make useNativeInit opt-in

* Make Android failure warning more clear

Co-authored-by: Krystof Woldrich <31292499+krystofwoldrich@users.noreply.github.com>

* Make Android no update warning more clear

Co-authored-by: Krystof Woldrich <31292499+krystofwoldrich@users.noreply.github.com>

* Use path.basename to get last path component

* Update tests to account for the new warnings

* Explicitly check for kotlin

* Add filename in the warning message

* Import only if init injection succeeds

* Explicitly check for Objective-C

* Add filename in the warning

* Make iOS file not found warning more clear

* Import only if init injection succeeds

* Reset test mock config in a function

* Lint issue

* Add missing quote

Co-authored-by: LucasZF <lucas-zimerman1@hotmail.com>

* Remove unneeded async

Co-authored-by: Krystof Woldrich <31292499+krystofwoldrich@users.noreply.github.com>

* Set useNativeInit = false by default

* dynamically fill white spaces

* Add unsupported language in warning message

* Add objcpp in detected languages

Co-authored-by: Krystof Woldrich <31292499+krystofwoldrich@users.noreply.github.com>

* Update tests for objcpp

* ref(expo-plugin): Split utils to logger, version and utils (#4906)

Co-authored-by: Antonis Lilis <antonis.lilis@gmail.com>

* Update changelog

* fix(ios): Add Swift module support for RNSentrySDK native init

Fixes Swift compilation errors when using the useNativeInit Expo plugin feature.

Changes:
- Updated RNSentry.h to use angle bracket import for RNSentrySDK, properly
  exposing it through the module system
- Added DEFINES_MODULE to RNSentry.podspec to enable Swift module generation
- Fixed Expo plugin to insert import after first import statement (supports
  modern Expo AppDelegate structure without UIKit import)

This enables Swift code to successfully import RNSentry and call
RNSentrySDK.start() when using native initialization.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* Fix test

* Update changelog

* Fix native tests

* Fix lint issue

* Fix native tests

* Revert unneeded changes

* Fix sample app build

---------

Co-authored-by: LucasZF <lucas-zimerman1@hotmail.com>
Co-authored-by: Krystof Woldrich <31292499+krystofwoldrich@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>

* Fix native ios tests

* Mark area

Co-authored-by: LucasZF <lucas-zimerman1@hotmail.com>

* fix(android): Fix ConcurrentModificationException (#5588)

* fix(android): Fix ConcurrentModificationException when disabling native crash handling

When enableNativeCrashHandling is set to false, the code was iterating over
the integrations list with a for-each loop while calling remove() directly,
which causes a ConcurrentModificationException at runtime.

Fixed by using Java 8's removeIf() method which safely handles iteration
and removal in a single operation. This is more concise and follows modern
Java best practices.

Added unit tests to verify the fix and ensure integrations are properly
removed without throwing exceptions.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* Lint fix

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>

* fix(android): Fix crash when spotlight is enabled without defaultSidecarUrl

The code attempted to read defaultSidecarUrl without checking if the key
exists in the options map. This caused a NoSuchKeyException crash during
startup when spotlight was set to true in sentry.options.json without
providing defaultSidecarUrl.

Added key existence check to match iOS implementation behavior and prevent
the crash while maintaining backward compatibility.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* test(e2e): Add auto init from JS tests for Android (#5583)

* test(e2e): Add auto init from JS tests for Android

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>

* fix(e2e): Add scrolling to find crash control buttons in Android test

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>

* fix(e2e): Make Android crash flag auto-expire after one crash

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>

* fix(e2e): Handle wrapped exceptions in Android crash test

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>

* Clean up notes for now

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>

* fix(android): Fix crash when dsn or devServerUrl are missing from options

Fixes a crash on Android startup when initializing from sentry.options.json
without dsn or devServerUrl fields. The code was calling getString() on
ReadableMap without checking if the keys exist first, which throws
NoSuchKeyException for missing keys.

Both fields are optional in configuration files, so the code now checks
for key existence before accessing values, returning null when keys are
missing. This matches the pattern used throughout the rest of the file
and is already handled correctly by the null-checks in the breadcrumb
filter logic.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Krystof Woldrich <31292499+krystofwoldrich@users.noreply.github.com>
Co-authored-by: Krystof Woldrich <krystof.woldrich@sentry.io>
Co-authored-by: getsentry-bot <bot@sentry.io>
Co-authored-by: getsentry-bot <bot@getsentry.com>
Co-authored-by: LucasZF <lucas-zimerman1@hotmail.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
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