Adding The SDK

Expo Web

For Expo web deployments, the LogRocket Javascript Web SDK must be used. See our web Quickstart and follow Web SDK guides from there. Note that the Web SDK can only be imported in Web builds of your app.

Expo Mobile

Our React Native package is available on NPM. New releases of the LogRocket Native SDKs are catalogued on our Mobile SDK Changelog.

expo install @logrocket/react-native

And then edit your app.json (or app.config.js) to include our SDK in the plugins list:

{
  "expo": {
    // ... your existing configuration
    "plugins": ["@logrocket/react-native"]
  }
}

Ensure the correct Android minimum SDK version is set

On Android, the LogRocket SDK supports Android API 25 and up. If your Expo app is configured to use a lower minimum Android SDK version then use the expo-build-properties plugin to set the minSdkVersion accordingly:

{
  "expo": {
    "plugins": [
      // ... your other existing plugins
      [
        "expo-build-properties",
      	{
          // ... other build-properties plugin settings
          "android": {
            "minSdkVersion": 25
          }
        }
      ]
    ]
  }
}
export default {
  expo: {
    plugins: [
      // ... your other existing plugins
      [
        'expo-build-properties',
        {
          // ... other build-properties plugin settings
          android: {
            minSdkVersion: 25,
          },
        },
      ],
    ],
  },
};

🚧

For Expo SDK version 50 and below you will need to set this additional expo-build-properties configuration for Android as well:

{
  "expo": {
    "plugins": [
      // ... your other existing plugins
      [
        "expo-build-properties",
      	{
          // ... other build-properties plugin settings
          "android": {
            // ... other android settings
            "extraMavenRepos": [
              "https://storage.googleapis.com/logrocket-maven/"
            ]
          }
        }
      ]
    ]
  }
}
export default {
  expo: {
    plugins: [
      // ... your other existing plugins
      [
        'expo-build-properties',
        {
          // ... other build-properties plugin settings
          android: {
            // ... other android settings
            extraMavenRepos: [
              'https://storage.googleapis.com/logrocket-maven/'
            ],
          },
        },
      ],
    ],
  },
};

If you are seeing errors that indicate that the LogRocket package cannot be found in any maven repositories then run npx expo prebuild --clean --platform android to clear out the existing native android build artifacts and then try re-building the project.