DEV Community

Moureen Caroline
Moureen Caroline

Posted on

My experience setting up a react-native environment on Ubuntu OS

Am a few months old in to serious programming with a background in java that I recently had to change to python due to the application that was assigned to me so am busy trying to understand python and how it works and boom little did I know then I was put on the team building a react- native application , now let’s get this clear i have not done anything in java-script or ES6 nor have I done any react of sorts, yeah confusing right ? yeah I surely was. Now it reaches a time to setup a react native environment on my Intel Pentium machine. So i get access to the react-native documentation and the instructions looked pretty straight forward , so I was like let’s do this!!!! The very thing was going on awesomely until I reached the step that had Android SDK tools that’s where everything became real right before I even wrote a single line of “Hello World ” in react-native. Tried everything possible on the internet but still things were not working out for at least 5 good days straight and the fact that i was installing on an Ubuntu machine did make anything easier since there are a few documents on the same errors that I was facing trying to setup the environment. But I finally got the breakthrough at the end .
Before proceeding, be sure to install the latest version of the following on Linux ( Ubuntu 18.04):
Node (V 12.10 as of writing)
Npm (V 6.10.3 as of writing)
Android SDK tools
Yarn
Git
Genymotion
Virtual-box
others :
USB cable
Mobile phone

After installing the virtual-box and confirming that it’s up and running

Creating the environment for the Android SDK tools;
$nano/etc/profile

Confirm that Android SDK is installed run the following;
echo $JAVA_HOME
echo $ANDROID_HOME

After one has configured an environment variable called ANDROID_HOME, run the following command to accept all the licenses.
yes | $ANDROID_HOME/tools/bin/sdkmanager — licenses

In case one is using Java version 10 and above, you will have trouble running the command above.First run the;
sudo update-alternatives — config java

To downgrade the Java to Java version 8 so that you can be in a position to run the command once again to get all the SDK licenses up-to-date.

Open up two different terminals
Run react-native start
Run react-native run-android
One will notice the execution is at 99% and its stuck at app:installDebug, why!! Cause its running the Genymotion Android Tools (default). You need to change the radio-button to Use custom Android SDK tools ( put the path of your sdktools)

walalalalalalala we got it baby and we are good to GO.
React-Native Here we come BABY!!!

Top comments (0)