0% found this document useful (0 votes)
32 views

How To Setup Android SDK Without Android Studio. by Nitish Sharma ProAndroidDev

The document discusses how to set up the Android SDK without Android Studio by using the Android command line tools. It provides steps to download the command line tools, set up the tools, add them to the system PATH, and install SDK packages. The process allows developers to access the Android SDK for mobile development using libraries like React Native or Flutter without needing the full Android Studio IDE.

Uploaded by

Gennius Dogba
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views

How To Setup Android SDK Without Android Studio. by Nitish Sharma ProAndroidDev

The document discusses how to set up the Android SDK without Android Studio by using the Android command line tools. It provides steps to download the command line tools, set up the tools, add them to the system PATH, and install SDK packages. The process allows developers to access the Android SDK for mobile development using libraries like React Native or Flutter without needing the full Android Studio IDE.

Uploaded by

Gennius Dogba
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

How to setup Android SDK without Android Studio. | by Nitish Sharma ... https://proandroiddev.com/how-to-setup-android-sdk-without-android-s...

How to setup Android SDK without Android


Studio.
Easily setup Android SDK using Android CLI for React Native, Flutter etc.

Nitish Sharma · Follow


Published in ProAndroidDev
5 min read · Mar 22, 2021

Listen Share

Photo by Glenn Carstens-Peters on Unsplash

1 sur 15 15/12/2023, 10:12


How to setup Android SDK without Android Studio. | by Nitish Sharma ... https://proandroiddev.com/how-to-setup-android-sdk-without-android-s...

The foundation of android mobile development using any library is the “Android
SDK”. Android SDK is the prerequisite for building android apps, be it via native
Kotlin, or other popular libraries like React Native and Flutter.

Now I’ve been building apps using React Native for about 4 years now, and didn’t
have any need for a full-fledged Android Studio IDE other than to install SDK(s) and
emulator(s). Also I’ll be honest, it’s a big IDE, till last month I was using a early 2015
macbook air with 128G of storage, so you can guess yourself how precious the space
was to me.

Also, I like using command line as much as I can, because for me, it’s easier than the
GUI (debatable, I know, but we all have our preferences).

So I looked for a way to install Android SDK and other stuff, without installing the
“Android Studio”, and I found it. Fortunately, Google has provided us with Android
Command-Line Tools. So in this article I would like to show you how you can set it
up.

Prerequisites
For this guide I assume you’ve already installed the Java JDK of your choice. I’d
suggest installing openjdk8, as it is prime choice for Android development, You can
install it via commands below.

For Mac -

brew install --cask adoptopenjdk/openjdk/adoptopenjdk8

For Linux -

You may download and install OpenJDK from AdoptOpenJDK or your system
packager.

2 sur 15 15/12/2023, 10:12


How to setup Android SDK without Android Studio. | by Nitish Sharma ... https://proandroiddev.com/how-to-setup-android-sdk-without-android-s...

Moving on, follow the Steps below to setup Android tools and install Android SDK.

Step 1 — Download the Command Line Tools


Yes, Download, instead of directly installing them, I know this is a drag but just bear
with me.

Click on this link to visit the download page, then to the Command Line Tools Only
section, and Download the zip file according to you operating sytem (preferably
Linux OR Mac, If you are using windows, switch your OS).

Here is the section you need to visit and click on the tools next to your operating system

Now after you’ve downloaded the zip file, move it to your home location i.e. ~/ .

Now there’s another way to do this in one step, you can just copy the link to the zip
file, then open a terminal window and:

~ $ wget <your zip link here>

Step 2 — Setting up the Android Tools (CLI)


Now that you’ve dowloaded the tools zip and moved it to home folder of your
system, we can go on ahead on setting them up, so that the CLI is available to you.

3 sur 15 15/12/2023, 10:12


How to setup Android SDK without Android Studio. | by Nitish Sharma ... https://proandroiddev.com/how-to-setup-android-sdk-without-android-s...

First we need to create a directory to store the android sdk and other stuff, so open a
terminal window and follow the steps:

~ $ mkdir android
~ $ cd android

Then we need to move and unzip the tools in android directory we just created:

~/android $ mv ~/commandlinetools-mac-6858069_latest.zip ./
~/android $ unzip commandlinetools-mac-6858069_latest.zip
~/android $ rm commandlinetools-mac-6858069_latest.zip

You can change the file name according to yours. At the time this article was written
this was the latest zip avaialable (for mac).

Now, here’s the tricky part which even confused me the first time I setup android
tools.

The above created android directory will act as our $ANDROID_HOME so other
libraries can access is from the environment variables we’re going to add ahead.

After unzipping the content, you will get a directory named cmdline-tools, now
follow the next steps carefully.

In the android directory:

$ cd cmdline-tools
$ mkdir tools
$ mv -i * tools

Last command will probably give you a warning, but you don’t need the worry about
that.

4 sur 15 15/12/2023, 10:12


How to setup Android SDK without Android Studio. | by Nitish Sharma ... https://proandroiddev.com/how-to-setup-android-sdk-without-android-s...

After running the commands above the new directory structure should look like
something like this:

android
└── cmdline-tools
└── tools
├── NOTICE.txt
├── bin
├── lib
└── source.properties

Step 3 — Adding tools to $PATH.


If you don’t have any experience with the environment variable $PATH, this guide
will probably give you a start. $PATH is used to tell the terminal where the binaries
are to be located, that are defined by user.

The file in which you have to append the PATH of the tools is in your home directory
~. for a bash terminal it’s .bash_profile where as for the newer zsh terminals it’s
.zshrc.

Now before we can add tools to path we have to add $ANDROID_HOME to the path,
to do that just open the .zshrc or .bash_profile in you preffered terminal file editor
(nano or vim) and add the following code at the end of the file:

export ANDROID_HOME=$HOME/android
export PATH=$ANDROID_HOME/cmdline-tools/tools/bin/:$PATH
export PATH=$ANDROID_HOME/emulator/:$PATH
export PATH=$ANDROID_HOME/platform-tools/:$PATH

After adding the code, save the file, close the terminal window and open a new
terminal window (I prefer this way as it makes reloading easier, without extra
commands).

After you’ve opened a new terminal window just type the following command and

5 sur 15 15/12/2023, 10:12


How to setup Android SDK without Android Studio. | by Nitish Sharma ... https://proandroiddev.com/how-to-setup-android-sdk-without-android-s...

hit return/enter.

$ sdkmanager

If you see the following progressbar, your tools have setup successfully:

[== ] 6% Fetch remote


repository...

If not you can go through the guide and check if you’ve followed the steps carefully.
If the probrem persists, feel free to drop in a comment.

Step 4 — Installing the Android SDK


If you’ve reached this step, congratulations, the journey ahead is clean and simple.

Use the following command to list all the available sdks, platform-tools, build tools,
emulator, ndks and what-not.

$ sdkmanager --list

To install the package you want, just copy the package name and install:

$ sdkmanager --install "package_name"

The basic packages you should install are, platform-tools , platforms;android-29 ,


build-tools;29.0.2 , emulator .

$ sdkmanager --install "platform-tools" "platforms;android-29"


"build-tools;29.0.2" "emulator"

6 sur 15 15/12/2023, 10:12


How to setup Android SDK without Android Studio. | by Nitish Sharma ... https://proandroiddev.com/how-to-setup-android-sdk-without-android-s...

This will install all the basic necessary tools you’ll require to start up your android
development.
Conclusion
If you’ve reached here, Congratulations, again. You’ve successfully setup your
Android Development Environment, without Android Studio. You can use the
library you’d like to work with i.e React Native or Flutter etc.

Although, the tools above should suffice for building your basic debug app, but, if
any other tools are to be installed, the libraries handle the installation automatically
for the most part, if not you can follow Step 4.

Thanks for Reading.

CHEERS!

Android Command Line Mobile App Development React Native Flutter

Follow

Written by Nitish Sharma


18 Followers · Writer for ProAndroidDev

Web and Mobile Developer (React.Js, React Native, Expo, Electron, Firebase, Amplify). India 🇮🇳
https://www.linkedin.com/in/nitishxyz

More from Nitish Sharma and ProAndroidDev

7 sur 15 15/12/2023, 10:12


How to setup Android SDK without Android Studio. | by Nitish Sharma ... https://proandroiddev.com/how-to-setup-android-sdk-without-android-s...

Nek.12 in ProAndroidDev

ViewModel: Events as State are an Antipattern


In this article Nikita explores how a popular notion about expressing events as states may be a
misleading one.

12 min read · Nov 20

865 5

8 sur 15 15/12/2023, 10:12


How to setup Android SDK without Android Studio. | by Nitish Sharma ... https://proandroiddev.com/how-to-setup-android-sdk-without-android-s...

Nirbhay Pherwani in ProAndroidDev

Kotlin Unknotting— From Realizing Anti-Patterns to Becoming a Better


Developer
An Insightful Guide to Avoiding Common Kotlin Pitfalls and Writing Idiomatically Beautiful Code

9 min read · Nov 29

368 4

Sven Nähler in ProAndroidDev

Elegant Event Handling in Kotlin—A Refactoring Walkthrough


Unlock peak performance in Kotlin code with these expert refactoring tips.

9 min read · Nov 20

511 9

9 sur 15 15/12/2023, 10:12


How to setup Android SDK without Android Studio. | by Nitish Sharma ... https://proandroiddev.com/how-to-setup-android-sdk-without-android-s...

Jaewoong Eum in ProAndroidDev

Improve Your Android App Performance With Baseline Profiles


Application performance holds paramount significance as it directly correlates with the overall
user experience. Within the developer…

10 min read · Dec 7

215 2

See all from Nitish Sharma

See all from ProAndroidDev

Recommended from Medium

10 sur 15 15/12/2023, 10:12


How to setup Android SDK without Android Studio. | by Nitish Sharma ... https://proandroiddev.com/how-to-setup-android-sdk-without-android-s...

Julien sez'n

Android Docker Image


🐳 Dockerizing the Android Development Environment..

4 min read · Jul 20

11 sur 15 15/12/2023, 10:12


How to setup Android SDK without Android Studio. | by Nitish Sharma ... https://proandroiddev.com/how-to-setup-android-sdk-without-android-s...

Satish Thakur

Firebase dynamic link deprecation and its alternates


This documentation contains information about the Firebase dynamic link depreciation, its use
cases and alternative solutions.

6 min read · Sep 28

42

Lists

Stories to Help You Grow as a Software Developer


19 stories · 630 saves

Staff Picks
535 stories · 528 saves

12 sur 15 15/12/2023, 10:12


How to setup Android SDK without Android Studio. | by Nitish Sharma ... https://proandroiddev.com/how-to-setup-android-sdk-without-android-s...

Jekayin-Oluwa Olabemiwo

[Resolved] Android Studio, Rosetta Installation Issues on Mac M1


Here’s how I got fixed some issues I had when setting up a local development environment for
Flutter on a Macbook M1 computer.

4 min read · Jul 5

51

Ismail Tasdelen in InfoSec Write-ups

Top Tools for Android Static Code Analysis: Streamline Your Development
Process
As the demand for feature-rich and secure Android applications continues to grow, developers
are constantly seeking ways to enhance their…

3 min read · Jun 20

13 sur 15 15/12/2023, 10:12


How to setup Android SDK without Android Studio. | by Nitish Sharma ... https://proandroiddev.com/how-to-setup-android-sdk-without-android-s...

Gavin Fong

5 Simple Steps to Master React Native Layout Development


The essential skills for anyone who would like to build their first mobile app

· 9 min read · Dec 3

23

14 sur 15 15/12/2023, 10:12


How to setup Android SDK without Android Studio. | by Nitish Sharma ... https://proandroiddev.com/how-to-setup-android-sdk-without-android-s...

Ruqaiya Sattar (She | Her)

Windows Development Environment Setup for Flutter Application


If you have joined new company and they gave you new system/laptop[windows] and asks you
to run and test flutter project on physical…

5 min read · Jul 17

See more recommendations

15 sur 15 15/12/2023, 10:12

You might also like