Setup for Linux Ubuntu
suggest change1) Set up Node.js
Start the terminal and run the following commands to install Node.js:
curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
sudo apt-get install nodejs
If node command is unavailable
sudo ln -s /usr/bin/nodejs /usr/bin/node
Alternative Node.js installations:
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
or
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt-get install -y nodejs
Check that Node is on your path
node -v
Install the React Native CLI
sudo npm install -g react-native-cli
2) Set up Java
sudo apt-get install lib32stdc++6 lib32z1 openjdk-7-jdk
3) Set up Android Studio:
Android SDK or Android Studio
http://developer.android.com/sdk/index.html
Android SDK and environment
export ANDROID_HOME=/YOUR/LOCAL/ANDROID/SDK
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
4) Set up an emulator:
On the terminal run the command
android
Select “SDK Platforms” from within the SDK Manager and you should see a blue checkmark next to “Android 7.0 (Nougat)”. In case it is not, click on the checkbox and then “Apply”.
5) Start a project
Example app init
react-native init ReactNativeDemo && cd ReactNativeDemo
Note: compileSdkVersion and buildToolsVersion in android/app/build.gradle must match an SDK and build-tools package you installed
android {
compileSdkVersion XX
buildToolsVersion "XX.X.X"
...
6) Run the project
Open Android AVD and create a virtual Android device:
android avd
Follow the instructions to create a virtual device and start it
Open another terminal and run the command lines:
react-native run-android
react-native start
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents