So you just started to develop react native, you follow the getting started guide, it required you to install Android studio and you was like ಠ_ಠ. As you may know, android studio is full featured Java android development IDE, you probably would not use that (except if you want to develop native modules). This article will guide you to install android sdk without android studio, forget the gui, we will use cli like a real programmer.

Prerequisite:

java jdk 8

nodejs & react-native-cli

Android phone (Creating Android Virtual Device is not discussed in this guide)

Step 1. Download Android SDK only

Open https://developer.android.com/studio/index.html, scroll to the bottom in the “Get just the command line tools” section. Download the appropriate version for your platform. Extract the zip file to /opt/android

Create ANDROID_HOME environment variable that point to that directory.

export ANDROID_HOME=/opt/android

using export, the environment variable will only present at current session, to be permanent add that line to ~/.bashrc

echo "export ANDROID_HOME=/opt/android" >> ~/.bashrc

Step 2. Download required sdk package

Because android sdk we have downloaded don’t provided GUI, we have to use cli. At the getting started guide, react native required:

Android 6.0 (Marshmallow) SDK (platform 23)

Android build tool 23.0.1

Google APIS

/opt/android/tools/bin/sdkmanager "platforms;android-23" "build-tools;23.0.1" "add-ons;addon-google_apis-google-23"

you will be asked for confirmation, type “y” then enter.

Step 3. Test your installation

Create example project

react-native init AwesomeProject

cd AwesomeProject

Plug in your android phone (don’t forget to enable usb debugging). Run the app

react-native run-android

It will take a while, it downloads gradle and other java dependencies for the first time. If the installation successful you will see the app show up on your phone.

Thanks for reading, give some ❤️ if you like this article.