Minimum Node v9.8.1 is required for setup. Go to the installation guide!
npm install -g react-native-cli
2} Install and setup jdk-8
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
sudo update-alternatives --config java
Will output:
There are 3 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1101 auto mode
1 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1101 manual mode
2 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 manual mode
* 3 /usr/lib/jvm/java-8-oracle/jre/bin/java 1081 manual mode
And select java-8-oracle
Link: https://developer.android.com/studio/#downloads
cd /opt/android-studio/bin
./studio.sh
Setup accourdingly
Open etc/environment
file and add proper jdk link
sudo nano /etc/environment
Append Java path, Android path and gradle path in the PATH variable and add also add JAVA_HOME, ANDROID_HOME seperately
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/java-8-oracle:/opt/android/sdk/tools:/opt/android/sdk/platform-tools:/opt/android-studio/gradle/gradle-4.6/bin"
JAVA_HOME="/usr/lib/jvm/java-8-oracle"
ANDROID_HOME="/opt/android/sdk"
Open ~/.bashrc
file and add proper jdk link
sudo nano ~/.bashrc
And the following line at the end
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
export ANDROID_HOME=/opt/android/sdk
Execute both of them
source /etc/environment
source ~/.bashrc
Android Studio installs the latest Android SDK by default. Building a React Native app with native code, however, requires the Android 9 (Pie) SDK in particular. Additional Android SDKs can be installed through the SDK Manager in Android Studio.
Select the "SDK Platforms" tab from within the SDK Manager, then check the box next to "Show Package Details" in the bottom right corner. Look for and expand the Android 9 (Pie) entry, then make sure the following items are checked:
Android SDK Platform 28 Intel x86 Atom_64 System Image or Google APIs Intel x86 Atom System Image Next, select the "SDK Tools" tab and check the box next to "Show Package Details" here as well. Look for and expand the "Android SDK Build-Tools" entry, then make sure that 28.0.3 is selected.
Finally, click "Apply" to download and install the Android SDK and related build tools.
git clone https://github.com/facebook/watchman.git
cd watchman
git checkout v4.9.0 # the latest stable release
sudo apt-get install libtool m4 automake pkg-config
./autogen.sh
./configure
sudo apt-get install python-dev python3-dev
make
sudo make install
react-native init AwesomeProject
First connect your device via usb and make sure developers tool and usb debugging is enabled.
After connecting the device, it may ask to allow usb debugging, accept it.
Then run the command inside the root directory of the project.
react-native run-android
react-native log-android