GitHub

Getting started with Expo apps

You can generate React Native projects with the React Native CLI or with the Expo CLI. Expo is a toolchain that allows you to quickly get a React Native app up and running without having to use native code in Xcode or Android Studio.

In this guide we discuss how to set up, test, code sign and deploy your React Native project built with the Expo CLI.

Whether you’ve been using ExpoKit or not with your project, Bitrise project scanner detects the necessary configuration and adds the [BETA] Expo Eject Step to your deploy workflow. If you’ve been using ExpoKit with your React Native app, Bitrise project scanner adds the necessary platform-specific dependency manager Steps to your workflow as well.

Adding an Expo app to bitrise.io

First, let’s see how to add a React Native Expo app to bitrise.io.

Do you have a Bitrise account?

Make sure you have signed up to bitrise.io and can access your Bitrise account. Here are 4 ways on how to connect your Bitrise account to your account found on a Git service provider.

  1. Log into bitrise.io.
  2. Click the + sign on the top menu bar and select Add app, which takes you to the Create New App page.
  3. Select the privacy setting of your app: private and public.
  4. Select the Git hosting service that hosts your repository, then find and select your own repository that hosts the project. Read more about connecting your repository.
  5. When prompted to set up repository access, click No, auto-add SSH key. Read more about SSH keys.
  6. Type the name of the branch that includes your project’s configuration - master, for example, - then click Next.
  7. At Validating repository, Bitrise runs an automatic repository scanner to set up the best configuration for your project.
  8. At Project build configuration, the React Native project type gets automatically selected. If the scanner fails and the project type is not selected automatically, you can configure your project manually. Bitrise also detects the Module and the Variant based on your project.

    Now let’s have a look at the fields you manually have to fill out:

    • To generate an iOS app from your React Native project, enter your iOS Development team ID at the Specify iOS Development team field.
    • In Select ipa export method, select the export method of your .ipa file: ad-hoc, app-store, development or enterprise method.
    • In Specify Expo username, enter your username and hit Next.
    • In Specify Expo password, enter your password and hit Next. You only need to provide your Expo credentials if you’ve been using ExpoKit with your project.
    • Confirm your project build configuration.
  9. Upload an app icon.
  10. At Webhook setup, register a Webhook so that Bitrise can automatically start a build every time you push code into your repository.

You have successfully set up your React Native project on bitrise.io! Your first build gets kicked off automatically using the primary workflow. You can check the generated reports of the first build on the APPS & ARTIFACTS tab on your Build’s page.

Installing dependencies

JavaScript dependencies

If Bitrise scanner has successfully scanned your app, depending on your project configuration, Run npm command or Run yarn command Step will be included in your workflow.

The default value of the Run npm command Step is install in the npm command with arguments to run input field. This way the Step can add JavaScript dependencies to your project.

Ejecting your app

React Native apps built with Expo do not come with native modules. Since our build Steps are platform-specific, Bitrise has to eject your app, add and configure the necessary native templates. Then our native dependency installer Steps take care of installing any missing native dependencies so that your project is ready for building and shipping.

The Bitrise project scanner automatically inserts the [BETA] Expo Eject Step right after the Run npm command or Run yarn command Steps in your deploy workflow.

Let’s see which fields you have to fill out when clicking [BETA] Expo Eject Step!

Native dependencies

The Install missing Android SDK components Step installs the missing native dependencies for your Android project. This Step is by default included in your deploy workflow.

If you’ve been using the ExpoKit to develop your app, the Run CocoaPods install Step is automatically added to your deploy workflow to take care of any missing iOS dependencies.

Testing your app

You can use React Native’s built in testing method, called jest, to perform unit tests on your app.

  1. Add another Run nmp command step to your workflow right after the first Run npm command Step.
  2. Type test in the npm command with arguments to run input field.

  3. Start a build.

You can view the test artifacts on the APPS & ARTIFACTS tab of your Build’s page.

Code signing

A React Native app consists of two projects; an Android and an iOS - both must be properly code signed. If you click on the Code Signing tab of your project’s Workflow Editor, all iOS and Android code signing fields are displayed in one page for you.

Let’s see how to fill them out!

Signing your Android app

  1. Select the deploy workflow at the WORKFLOW dropdown menu in the top left corner of your app’s Workflow Editor.
  2. Go to the Code Signing tab.
  3. Drag-and-drop your keystore file to the ANDROID KEYSTORE FILE field.
  4. Fill out the Keystore password, Keystore alias, and Private key password fields and click Save metadata.

    You should have these already at hand as these are included in your keystore file which is generated in Android Studio prior to uploading your app to Bitrise. For more information on keystore file, click here. With this information added to your Code Signing tab, our Sign APK step (by default included in your Android deploy workflow) will take care of signing your APK so that it’s ready for distribution!

More information on Android code signing

Head over to our Android code signing guide to learn more about your code signing options!

The Android chunk of code signing is done. Let’s continue with iOS!

Signing and exporting your iOS app for deployment

To deploy to Testflight and to the App Store, you will need the following code signing files:

  1. Open the Workflow tab of your project on bitrise.io.
  2. Click on Code Signing tab.
  3. Click or drag and drop the App Store type provisioning profile in the PROVISIONING PROFILE field and the iOS Distribution certificate in the CODE SIGNING IDENTITY field.
  4. Click on the Workflows tab and select your deploy Workflow.
  5. Set the Select method for export input field of the Xcode Archive & Export for iOS Step to app-store.
  6. Select Xcode Archive & Export for iOS Step and scroll down to the Force Build Settings input group.
  7. Fill out the following input fields based on your uploaded code signing files:

    Force code signing with Development Team: Add the team ID.

    Force code signing with Code Signing Identity: Add the Code Signing Identity as a full ID or as a code signing group.

    Force code signing with Provisioning Profile: Add the provisioning profile’s UDID (and not the file name).

  8. If the code signing files are manually generated on the Apple Developer Portal, you have to specify to use manual code signing settings since the ejected React Native project have Xcode managed code signing turned on. Click the Debug input group and add CODE_SIGN_STYLE="Manual" to the Additional options for xcodebuild call input field.

Deploying to Bitrise

The Deploy to bitrise.io Step uploads all the artifacts related to your build into the APPS & ARTIFACTS tab on your Build’s page.

You can share the generated APK/.ipa file with your team members using the build’s URL. You can also notify user groups or individual users that your APK/.ipa file has been built.

  1. Go to the Deploy to bitrise.io Step.
  2. In the Notify: User Roles input field, add the role so that only those get notified who have been granted with this role. Or fill out the Notify: Emails field with email addresses of the users you want to notify. Make sure you set those email addresses as secret env vars! These details can be also modified under Notifications if you click the eye icon next to your generated APK/.ipa file in the APPS & ARTIFACTS tab.

Deploying to an app store

If you wish to deploy your iOS app, follow the steps in Signing and exporting your iOS app for deployment.

Deploying your iOS app to Testflight and iTunes Connect

Have you exported an app-store .ipa file yet

Make sure that you have exported an app-store .ipa file before starting the deployment procedure to a native marketplace!

  1. Modify the Xcode Archive & Export for iOS Step’s input fields to the force options and upload the app store profile and distribution certificate manually.
  2. Add the Deploy to iTunes Connect - Application Loader Step to your workflow.

    Put the Step after the Xcode Archive & Export for iOS Step but preferably before the Deploy to Bitrise.io Step.

  3. Provide your Apple credentials in the Deploy to iTunes Connect - Application Loader Step.

    The Step will need your:

    • Apple ID
    • password or, if you use two-factor authentication on iTunes Connect, your app-specific password.

    Don’t worry, the password will not be visible in the logs or exposed - that’s why it is marked SENSITIVE.

  4. Start a build.

    If everything went well, you should see your app on Testflight. From there, you can distribute it to external testers or release it to the App Store.

Deploying your Android app to Google Play Store

Have you uploaded keystore file yet

Make sure that you have uploaded the keystore file to the ANDROID KEYSTORE FILE field before starting the deployment procedure to the marketplace!

Before you’d use the Google Play Deploy Step, make sure you have performed the following tasks:

  1. Upload the first APK manually to Google Play using the Google Play Console.
  2. Link your Google Play Developer Console to an API project.
  3. Set up API Access Clients using a service account: Please note when you create your service account on the Google Developer Console, you have to choose json as Key Type.
  4. Grant the necessary rights to the service account with your Google Play Console. Go to Settings, then Users & permissions, then Invite new user. Due to the way the Google Play Publisher API works, you have to grant at least the following permissions to the service account:
    • Access level: View app information.
    • Release management: Manage production releases, manage testing track releases.
    • Store presence: Edit store listing, pricing & distribution.
  5. As an optional step, you can add translations to your Store Listing. To allow the Google Play Deploy Step to assign your whatsnew files to the uploaded APK version, visit the Translate & localize your app guide and add translations to your Store Listing section.

Now let’s head back to Bitrise and finish off the deploy configuration!

  1. In your Bitrise Dashboard, go to Code Signing tab and upload the service account JSON key into the GENERIC FILE STORAGE.
  2. Copy the env key which stores your uploaded file’s url.

    For example: BITRISEIO_SERVICE_ACCOUNT_JSON_KEY_URL

  3. Add the Google Play Deploy Step after the Sign APK Step in your deploy workflow.
  4. Fill out the required input fields as follows:

    Service Account JSON key file path: This field can accept a remote URL so you have to provide the environment variable which contains your uploaded service account JSON key. For example: $BITRISEIO_SERVICE_ACCOUNT_JSON_KEY_URL

    Package name: the package name of your Android app.

    Track: the track where you want to deploy your APK (for example, alpha/beta/rollout/production or any custom track you set).

And that’s it! Start a build and release your app to the Google Play Store.