I was recently experimenting building a react native app. After digging a bit deeper into hybrid development, I have got attracted to the concept of producing a native code, in contrast to the web view approach in most of hybrid apps.
So here’s what we’ve got. Setting it up:
If you go to https://facebook.github.io/react-native/docs/getting-started.html you’ll get some instructions how to set it up.
- Install JDK
- Install Android SDK
- Adding android SDK path to the ~/.bashrc
- export ANDROID_HOME=/usr/local/opt/android-sdk
JDK can be installed using this link:
Android SDK can be installed using:
brew install android-sdk
After finishing these 3 steps, we would need to install some android packages.
Open Android package manager:
These packages will be required to run the android simulator:
- Android SDK Build-tools version 23.0.1
- Android 6.0 (API 23)
- Android Support Repository
- Intel x86 Atom System Image (for Android 5.1.1 – API 22)
- Intel x86 Emulator Accelerator (HAXM installer)
You would also require to download IntelHAXM.dmg file, which you can do from:
Run the installation file after download dmg.
- Install IntelHAXM.dmg
- <sdk> is /usr/local/opt/android-sdk on OS X
- To check that configuration is done correctly
- kextstat | grep intel
- You should see message
At this point we would like to create an android virtual device (AVD):
# launching avd manager android avd
Click “Create” and choose the following options for your AVD:
Now your AVD is created and you can start your emulator using:
emulator -avd <avd name> # in our example: emulator -avd reactnative
iOS emulator will be installed automatically as part of Xcode installation. You can install Xcode from the the app store and choose the particular emulator to start from within Xcode.