Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions .github/workflows/update-deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ jobs:
secrets:
api-token: ${{ secrets.CI_DEPLOY_KEY }}

android-stubs:
uses: getsentry/github-workflows/.github/workflows/updater.yml@v2
with:
path: scripts/update-android-stubs.sh
name: Android SDK Stubs
pr-strategy: update
secrets:
api-token: ${{ secrets.CI_DEPLOY_KEY }}

cocoa:
uses: getsentry/github-workflows/.github/workflows/updater.yml@v2
with:
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@

## Unreleased

### Fixes

- Session Replay: Allow excluding `sentry-android-replay` from android targets ([#5174](https://github.com/getsentry/sentry-react-native/pull/5174))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It would be nice to include a simple mention on how to remove it with a sample diff

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Example of what we did for Web Replay: https://github.com/getsentry/sentry-react-native/blob/cf745081e2928fd7b1459e38989d54d8ef0815b9/CHANGELOG.md#features-25

And with that, it's optional, but we could also include an estimation on how much app size is reduced when users opt out for mobile replay.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Added both 👍

- If you are not interested in using Session Replay, you can exclude the `sentry-android-replay` module from your Android targets as follows (saves nearly 40KB compressed and 80KB uncompressed off the bundle size):

```gradle
// from the android's root build.gradle file
subprojects {
configurations.all {
exclude group: 'io.sentry', module: 'sentry-android-replay'
}
}
```

### Dependencies

- Bump JavaScript SDK from v10.8.0 to v10.11.0 ([#5142](https://github.com/getsentry/sentry-react-native/pull/5142), [#5145](https://github.com/getsentry/sentry-react-native/pull/5145), [#5157](https://github.com/getsentry/sentry-react-native/pull/5157))
Expand Down
1 change: 1 addition & 0 deletions packages/core/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ android {
}

dependencies {
compileOnly files('libs/replay-stubs.jar')
implementation 'com.facebook.react:react-native:+'
api 'io.sentry:sentry-android:8.21.1'
}
Binary file added packages/core/android/libs/replay-stubs.jar
Binary file not shown.
17 changes: 17 additions & 0 deletions packages/core/android/replay-stubs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
This module is needed to successfully compile the Android target for the cases when `sentry-android-replay` is excluded from the host app classpath (for example, to reduce the resulting bundle/apk size), e.g. via the following snippet:

```gradle
subprojects {
configurations.all {
exclude group: 'io.sentry', module: 'sentry-android-replay'
}
}
```

It provides stubs for the Replay classes that are used by the React Native SDK and is being added as a `compileOnly` dependency to `android/build.gradle` (meaning, it is not present at runtime and does not affect our customers' code).

In addition, we also check for the `sentry-android-replay` classes presence at runtime and only then instantiate the replay-related classes (currently only `RNSentryReplayBreadcrumbConverter`) to not cause a `NoClassDefFoundError`.

## Updating the stubs

To update the stubs, just run `yarn build` from the root of the repo and it will recompile the classes and put them under `packages/core/android/libs/replay-stubs.jar`. Check this newly generated `.jar` in and push.
22 changes: 22 additions & 0 deletions packages/core/android/replay-stubs/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
allprojects {
repositories {
mavenCentral()
}
}

apply plugin: 'java-library'

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

tasks.named('jar', Jar) {
archiveBaseName.set('replay-stubs')
archiveVersion.set('')
destinationDirectory.set(file("$rootDir/../libs"))
}

dependencies {
compileOnly 'io.sentry:sentry:8.21.1'
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
251 changes: 251 additions & 0 deletions packages/core/android/replay-stubs/gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading