React Native 0.71 source map upload limitation

Due to recent changes to the Gradle build configuration for React Native, JavaScript source maps will not be automatically uploaded for Android builds when using React Native 0.71 and above.

We are working on a new iteration of our tooling that reduces our reliance on React Native’s Gradle scripts. In the meantime the BugSnag Gradle Plugin will only upload native Android mapping and symbol files. This document describes the additional steps required to upload your JavaScript source map files for your React Native app when building for Android.

If you are using React Native 0.70 or before, please follow the instructions in the main integration guide.

Disable source map uploads in the BugSnag Gradle Plugin

You should leave the BugSnag Gradle Plugin installed, as per the the main integration guide to upload your native Android mapping and symbol files, however you will need to disable, or remove, the JavaScript source map upload in android/build.gradle:

bugsnag {
    uploadReactNativeMappings = false
}

Run the BugSnag Source Maps CLI

You will then need to call the BugSnag Source Maps tool (which would usually called by the BugSnag Gradle plugin when uploadReactNativeMappings is enabled) to upload your JavaScript source maps to BugSnag.

The tool will have been installed via NPM/yarn if you used our CLI to install BugSnag (see here for installation instructions). Depending on how you build your app, you can either call it via the command line or via its JavaScript API.

For example:

bugsnag-source-maps upload-react-native \
  --api-key YOUR_API_KEY_HERE \
  --app-version YOUR_APP_VERSION \
  --app-version-code YOUR_APP_VERSION_CODE \
  --platform android \
  --source-map android-release.bundle.map \
  --bundle android-release.bundle

See the Source Maps for React Native guide for details on which parameters are required for your app.