Welcome to %s forums

<No. 1 Community for developers, by developers/>

Login Register

How to Configure your linux machine for React Native development?

React Native related topics are here
Post Reply
admin
Site Admin
Posts: 45

How to Configure your linux machine for React Native development?

Post by admin » Sat Oct 19, 2019 11:05 pm

Setup for Linux (Ubuntu)
1) Setup Node.JS
Start the terminal and run the following commands to install nodeJS:

Code: Select all

curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
sudo apt-get install nodejs
If node command is unavailable

Code: Select all

sudo ln -s /usr/bin/nodejs /usr/bin/node
Alternatives NodeJS instalations:

Code: Select all

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
or

Code: Select all

curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt-get install -y nodejs
check if you have the current version

Code: Select all

node -v
Run the npm to install the react-native

Code: Select all

sudo npm install -g react-native-cli
2) Setup Java

Code: Select all

sudo apt-get install lib32stdc++6 lib32z1 openjdk-7-jdk
3) Setup Android Studio:
Android SDK or Android Studio
http://developer.android.com/sdk/index.html
Android SDK e ENV

Code: Select all

export ANDROID_HOME=/YOUR/LOCAL/ANDROID/SDK
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

4) Setup emulator:

On the terminal run the command

Code: Select all

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"

Image

5) Start a project
Example app init

Code: Select all

react-native init ReactNativeDemo && cd ReactNativeDemo
Obs: Always check if the version on android/app/build.gradle is the same as the Build Tools downloaded on
your android SDK

Code: Select all

android {
 compileSdkVersion XX
 buildToolsVersion "XX.X.X"
...

6) Run the project

Open Android AVD to set up a virtual android. Execute the command line:

Code: Select all

android avd
Follow the instructions to create a virtual device and start it
Open another terminal and run the command lines:

Code: Select all

react-native run-android

Code: Select all

react-native start

Post Reply