Skip to content

Getting Started with Flagship

Brett Weissbart edited this page Jul 25, 2019 · 3 revisions

Setting up your Development Environment

You'll need a Mac with Xcode to build iOS applications. Windows and Linux computers can be used to develop Android applications.

We recommend following React Native's Getting Started guide for installing all necessary applications and frameworks.

  1. Click the "React Native CLI Quickstart" tab
  2. Select the tab corresponding to your development machine's OS: macOS, Windows, or Linux
  3. Select the tab corresponding to the mobile OS you which to set up: iOS or Android
  4. Follow the steps in the "Installing Dependencies" section
  5. Repeat for all mobile OSes you wish to use

In addition to the dependencies listed by React Native, you'll also need Yarn for package management. Please refer to the instructions on their website to install Yarn.

First time Flagship setup

  1. Fork the Flagship repository into your own Github account
  2. Clone your fork of Flagship
  3. Run yarn in order to install dependencies and run the TypeScript compiler

Testing on iOS

If you installed Xcode as part of the setup process, you have everything you need to test in an iOS simulator. Simply run PirateShip (see next section) and a simulator will automatically boot with the application.

Testing on Android

React Native cannot automatically start an Android emulator, so you'll need to do one of the following in order to test on Android:

Option 1: create and start an emulator

  1. Open Android Studio
  2. Click the AVD Manager button (top right menu)
  3. If you don't have any virtual devices set up, click Create Virtual Device and follow the wizard
  4. Select a virtual device and click Start to open the emulator
  5. You can then run PirateShip (see below) and it will launch on the selected emulator

Option 2: run on a physical device

  1. Connect an Android device to your computer via USB
  2. Open the Settings app
  3. Navigate to "About phone"
  4. Tap on the "Build number" item 10x in a row to enable developer mode
  5. Go back to the main Settings menu and select "Developer options"
  6. Verify that the "USB debugging" checkbox is enabled
  7. You may need to change your phone's USB mode from charging only to data transfer mode. Refer to your phone's documentation for more information.
  8. From your computer, run adb devices which will list all physical and emulator devices and their debugging status
    • If the device isn't displayed, either the phone isn't in developer mode, USB debugging mode is disabled, or the USB mode is set to charging only
    • If the device is listed as "unauthorized", USB debugging is disabled or you haven't given the current computer permission to access your device. Try tapping "Revoke USB debugging authorizations" and then turn USB debugging off then on again and you should get a prompt to allow debugging
    • If the device is listed as "device" debugging should be ready to go. Run yarn run ship:run-android (see below) and the application will run on the connected device.

Running PirateShip

PirateShip is a demo app that can be used to try out Flagship and test new features. Its code is located in /packages/pirateship.

From the Flagship root directory (not pirateship), run the following:

  1. yarn run ship:init
  2. yarn run ship:run-ios or yarn ship:run-android