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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
> make sure you follow our [migration guide](https://docs.sentry.io/platforms/react-native/migration/) first.
<!-- prettier-ignore-end -->

## Unreleased

### Fixes

- Fix Android New Architecture build failing at CMake configure on React Native 0.75 by gating the `libsentry-tm-perf-logger.so` native build to RN 0.76+ ([#6407](https://github.com/getsentry/sentry-react-native/pull/6407))

## 8.17.1

### Fixes
Expand Down
21 changes: 12 additions & 9 deletions packages/core/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ def isNewArchitectureEnabled() {
}

// `libsentry-tm-perf-logger.so` links against React Native's `reactnative`
// prefab target, which only ships in the `ReactAndroid` prefab AAR shipped
// with RN 0.75 and newer. On older RN releases the target does not exist
// and a `find_package(ReactAndroid)` call would fail the CMake configure
// step before we ever get to the build. Gate the native build on the host
// app's `react-native` version so older legacy-arch matrix entries that
// prefab target. The merged `libreactnative.so` (exposed as the
// `ReactAndroid::reactnative` prefab) only ships from RN 0.76 onward; on RN
// 0.75 and earlier the native code is split across separate prefab modules
// and `ReactAndroid::reactnative` does not exist, so `find_package(ReactAndroid)`
// / `target_link_libraries(... ReactAndroid::reactnative)` would fail the CMake
// configure step before we ever get to the build. Gate the native build on the
// host app's `react-native` version so older legacy-arch matrix entries that
// (intentionally or not) end up with `newArchEnabled=true` do not pull in
// our CMake target.
def isReactNativePrefabAvailable() {
Expand All @@ -31,10 +33,11 @@ def isReactNativePrefabAvailable() {
}
def major = parts[0].toInteger()
def minor = parts[1].toInteger()
// RN 0.75+ ships the `ReactAndroid::reactnative` prefab. Anything
// earlier is a legacy-only target as far as our native code is
// concerned.
return major > 0 || minor >= 75
// RN 0.76+ ships the merged `ReactAndroid::reactnative` prefab.
// Anything earlier (incl. 0.75, which still splits the native code
// across separate prefab modules) has no such target as far as our
// native code is concerned.
return major > 0 || minor >= 76
} catch (Exception ignored) {
return false
}
Expand Down
Loading