Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
29 lines (20 sloc) 1.72 KB

Run app on iOS simulator and Android emulator at same time

Just as personal documentation, these are the steps I've needed to follow to run an Android emulator and iOS simulator, side by side, both with live reload enabled.

  1. I've needed to install Watchman with brew install watchman.
  2. I've also needed to install the React Native CLI with npm install -g react-native-cli.
  3. Pretty obvious, I already had both Xcode and Android Studio installed on my Mac.

iOS simulator

  1. With react-native run-ios I launch the React Packager. Same thing can be done with npm run ios provided package.json contains a scripts section like this:
"scripts": {
  "start": "react-native start",
  "android": "react-native run-android",
  "ios": "react-native run-ios",
  "test": "node node_modules/jest/bin/jest.js"
}
  1. At this point, the iOS simulator gets opened automatically and loads the app. I can reload it every time after saving changes in the code using ⌘R in the simulator. Even better, live reload can be enabled from the developer menu (Hardware > Shake Gesture).

Android emulator

  1. First of all, I need to manually open an Android emulator using ~/Library/Android/sdk/tools/emulator -avd Nexus_4_API_25 (more details about this command at Run AVD emulator without running Android Studio).
  2. With react-native run-android I launch the React Packager. Same thing can be done with npm run android (again, provided package.json contains a scripts section as stated above).
  3. At this point, the Android emulator loads the app. Live reload can be enabled from the developer menu (⌘M).