How to set up Android for React-Native without Android Studio but only using the SDK tools?

Viewed 13754

I've read pretty much read every article from google search, watched all the YouTube tutorials and checked out all the StackOverflow questions relating to this but cannot find my answer.

The official (but outdated) docs is not all that useful at all.
https://facebook.github.io/react-native/releases/0.23/docs/android-setup.html
http://facebook.github.io/react-native/releases/0.40/docs/getting-started.html

I am using Windows 10.

So far I have,


User Variables:

PATH
C:\Users\RickyDam\AppData\Local\Android\android-sdk\tools
C:\Users\RickyDam\AppData\Local\Android\android-sdk\platform-tools


System Variables:

ANDROID_HOME
C:\Users\RickyDam\AppData\Local\Android\android-sdk

ANDROID_SDK_HOME
C:\Users\RickyDam\AppData\Local\Android\android-sdk

JAVA_HOME
C:\Program Files\Java\jdk1.8.0_144

PATH
C:\Users\RickyDam\AppData\Local\Android\android-sdk\tools
C:\Users\RickyDam\AppData\Local\Android\android-sdk\platform-tools


My git bash just keeps showing

bash: android: command not found

And if I try to type in android.bat, it returns

The "android" command is deprecated.
For manual SDK, AVD, and project management, please use Android Studio.
For command-line tools, use tools\bin\sdkmanager.bat
and tools\bin\avdmanager.bat

And then if I try to type in sdkmanager.bat, I get

bash: sdkmanager.bat: command not found

EDIT:
I found out about the official SDK Manager installer made by Google Inc. and now my folder C:\Users\RickyDam\AppData\Local\Android\android-sdk looks like this

screenshot of android-sdk folder

But I still get

android: command not found

even though my environment variables seem to all be in place...

2 Answers

Mac Users

Assuming you already have:

  1. Java JDK 8
  2. nodejs and react-native cli

Now let's download only command line tools (which is bottom of ) this link

Follow these steps wisely:

  1. unzip the folder in /opt/andriod directory

  2. export ANDROID_HOME=/opt/android

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

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

You are all done.Congrats! if you made it all.Now from RN proj. folder run:

react-native run-android
Related