Skip to content

Integrate Revopush OTA with Expo

This guide will help you to set up your Expo project and make first Revopush release.

Create an application

  1. Go to Applications and add an application

Add new application

  1. Enter application name and save it

Add new application modal

  1. As a result, you will see your application in the list with two deployments available out of the box

Application list

Setup Revopush SDK

Revopush SDK doesn't work with Expo Go because it requires native code changes.

Expo SDKRevopush SDKRevopush Expo plugin
52+1.3.01.0.0

Install Revopush SDK

bash
npx expo install @revopush/react-native-code-push

Install Revopush Expo plugin

bash
npx expo install @revopush/expo-code-push-plugin

Setup Expo config plugin

If you don't have, add Expo dynamic config to your project

Go to app settings to get Deployment keys:

Application deployments

Extend Plugin section in your Expo config with:

typescript
module.exports = ({ config }: { config: ExpoConfig }) => ({
    ...config,
    plugins: [
        ["@revopush/expo-code-push-plugin", {   
            ios: {  
                CodePushDeploymentKey: 'YOUR_DEPLOYMENT_KEY',   
                CodePushServerUrl: 'https://api.revopush.org'
            }, 
            android: { 
                CodePushDeploymentKey: 'YOUR_DEPLOYMENT_KEY', 
                CodePushServerUrl: 'https://api.revopush.org'
            } 
        }] 
    ],
});

Run prebuild command to generate native ios and android folders

bash
npx expo prebuild --clean

WARNING

If you faced with ios target version error, add expo-build-properties plugin and set ios deploymentTarget to 15.5

JS configuration

Configure the SDK in the JavaScript layer of your expo app (minimal setup):

js
import codePush from "@revopush/react-native-code-push"; 

function RootLayout() {}

export default codePush(RootLayout); 

Configure CLI

After registration, install the Revopush CLI.

shell
npm install -g @revopush/code-push-cli

Login to Revopush CLI using the following command:

shell
revopush login

This will launch a browser, asking you to authenticate with either your GitHub or Google account. This will generate an access key that you need to copy/paste into the CLI (it will prompt you for it). You are now successfully authenticated and can safely close your browser window.

shell
Opening your browser...
Visit https://app.revopush.org/cli-login?hostname=<YOUR_HOST_NAME> and enter the code

Enter your access key:

Read more about Revopush CLI

Make a release

Release process contains from 2 steps: generating bundle and releasing it to Revopush.

Android

Run expo export command to generate production HermesJS bundle and assets:

bash
npx expo export:embed \
  --platform android \
  --dev false \
  --reset-cache \
  --bundle-output ./build-android/index.android.bundle \
  --assets-dest ./build-android \
  --bytecode

To release this bundle run:

bash
revopush release <APP_NAME> ./build-android <TARGET_VERSION> -d <APP_ENVIRONMENT> --mandatory

iOS

Run expo export command to generate production HermesJS bundle and assets:

bash
npx expo export:embed \
  --platform ios \
  --dev false \
  --reset-cache \
  --bundle-output ./build-ios/main.jsbundle \
  --assets-dest ./build-ios \
  --bytecode

To release this bundle run:

bash
revopush release <APP_NAME> ./build-ios <TARGET_VERSION> -d <APP_ENVIRONMENT> --mandatory

Test locally

To test Revopush on your simulator or device you need to run application in release mode.

For Android:

bash
npx expo run:android --variant release --no-bundler

For iOS:

bash
npx expo run:ios --configuration Release

WARNING

Every time you change Revopush settings inside app config you need to run npx expo prebuild --clean to apply these changes on native side

Troubleshooting

If you see this message in logs:

The error message: Update is invalid - A JS bundle file named "null" could not be found within the downloaded contents. Please check that you are releasing your
CodePush updates using the exact same JS bundle file name that was shipped with
your app's binary.

You will probably need to remove expo-updates package.

bash
npm uninstall expo-updates

Then remove expo-updates specific app config properties and run prebuild to uninstall native expo-updates dependencies

bash
npx expo prebuild --clean