Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,19 @@ static void updateWithReactDefaults(
* applied after the configureOptions callback during manual native initialization.
*/
static void updateWithReactFinals(@NotNull SentryAndroidOptions options) {
if (!BuildConfig.VERSION_NAME.equals(RNSentryVersion.EXPECTED_ANDROID_SDK_VERSION)) {
options
.getLogger()
.log(
SentryLevel.WARNING,
"sentry-android resolved to %s, but @sentry/react-native expects %s. "
+ "This may cause crashes at startup. "
+ "If you use the Sentry Android Gradle Plugin, disable autoInstallation: "
+ "https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/",
BuildConfig.VERSION_NAME,
RNSentryVersion.EXPECTED_ANDROID_SDK_VERSION);
}

BeforeSendCallback userBeforeSend = options.getBeforeSend();
options.setBeforeSend(
(event, hint) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ class RNSentryVersion {
static final String NATIVE_SDK_NAME = "sentry.native.android.react-native";
static final String ANDROID_SDK_NAME = "sentry.java.android.react-native";
static final String REACT_NATIVE_SDK_NAME = "sentry.javascript.react-native";
static final String EXPECTED_ANDROID_SDK_VERSION = "8.41.0";
}
6 changes: 6 additions & 0 deletions scripts/update-android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ set-version)
expoHandlerContent=$(echo "$expoHandlerContent" | sed -E "s/(io\.sentry:sentry-android:)([0-9\.]+)/\1$2/g")
echo "$expoHandlerContent" >$expoHandlerFile

# Update expected version constant in RNSentryVersion.java
versionFile='src/main/java/io/sentry/react/RNSentryVersion.java'
versionContent=$(cat $versionFile)
versionContent=$(echo "$versionContent" | sed -E "s/(EXPECTED_ANDROID_SDK_VERSION = \")([0-9\.]+)/\1$2/")
echo "$versionContent" >$versionFile

# Update replay-stubs to match
cd $ORIGINAL_DIR
./update-android-stubs.sh set-version $2
Expand Down
Loading