Skip to main content

Adding the React Native Embrace SDK

Add the JavaScript library

Use Yarn or NPM to install the NPM module.

yarn add react-native-embrace
npm install react-native-embrace --save
info

If you are using a yarn workspace, you must run the command at the react-native application folder level or modify package.json manually. Do not run this on your yarn workspace root.

Native Modules

If you're on React Native version 0.60 and above, you can use Autolinking to set up the native modules.

Configure your PodFile to add Embrace. (RN Versions < 0.6)

target 'MyApp' do
# ...

pod 'EmbraceIO'
pod 'RNEmbrace', :path => '../node_modules/react-native-embrace'
end

Then, install the pod.

cd ios && pod install --repo-update

Adding the SDK

Setup Script

The JavaScript Embrace SDK ships with a setup script to modify the files in your project to add the native dependencies. The setup scripts can be found in your node_modules folder at node_modules/react-native-embrace/dist/scripts/setup

Run the setup script

node node_modules/react-native-embrace/dist/scripts/setup/installAndroid.js
node node_modules/react-native-embrace/dist/scripts/setup/installIos.js

You can use git to see the changes that the script made.

git diff

Compare the changes to the Manual Setup step to verify the changes were made correctly.

Manually

You'll need to add an Embrace-Info.plist file at the root of the iOS project. Please see the Session Reporting page from the iOS integration guide page on how to add this file in Xcode.


There's a little more configuration we have to do to set up the uploading of symbol files. You'll be learning about that next.