How to install Android SDK

To build an Android app, We need installing some requirement application before installing Android SDK.

1. Install Java Development Kit.

Download & install Java SE ‘java development kit’

From here:

2. Install Ant Apache

Download Ant Apache from:

Choose zip if you use Windows, and tar.gz if Linux.

3. Install Android SDK

There are two versions: Android Studio and Android SDK. With Android Studio provide you an IDE to build Android app but it will cost much of Memory.

I recommend you to download and install Android SDK, more lightweight and easy to develop.

Download from:

4. Setup environment variable

With Windows:

Go to System Property -> Advanced -> Set Environment Variables. In the second box ‘System Variables’.

New a JAVA_HOME name and value is the path to your Java Directory. Example: K:\\Program Files\\Java\\jdk1.8.0_65 if you already have, we move to the next step.

New a ANT_HOME name and value also path to your extracted directory Example: C:\ant

In the ‘Path’ variable, edit it and add these; K:\Program Files\Android\android-sdk\tools;%ANT_HOME%/bin;%JAVA_HOME%/bin Notice:

If you install your android sdk another directory you can edit the path above.

With Linux:

Open ~/.bashrc and setup your path, below paths are my example with “~/opt/…”, you can edit if you wish as soon as it refer to your package folder.

export JAVA_HOME=~/opt/jdk1.8.0_91
export PATH=${PATH}:${JAVA_HOME}/bin

export ANT_HOME=~/opt/apache-ant-1.9.7
export PATH=${PATH}:${ANT_HOME}/bin

export ANDROID_HOME=~/opt/android-sdk
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools

Ok, Now go to your command line or terminal and check it. Make sure all of them run successfully.

java -version
javac -version
ant -version
android -version

5. Install packages for Android version.

Now go to your command line or terminal again and type:

android sdk

A SDK manager will appear, You need to choose your android version and install it, if you choose any android version you ought to install full packages of them. What it recommend packages, you should install all.

Now again, type: android avd. This is help you to make a emulator android, Click create a new one. And start, after that it will appear the emulator android.

But I would rather use Genymotion to emulate Android, in the next tutorial I will share how to install Genymotion.

6. Create your sample project

Now create your own project. Go to your command line again and then type:

android create project --name YourTestProject --path .\TestProject --target 1 --package --activity MainActivity

–name: is your name project. –path: location you want to create –target: what android version you want to build on. You can look up it by type: android list target And choose your id android version. –package: i don’t know obvious, –activity: just default.

After create successfully, go to your android project directory.

7. Signing your Android app.

You need to create a keystore in order to sign your android app. To create a keystore, you type this:

keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000

my-release-key: you can replace it by the name you want. alias_name: also replace what name you want. -validity: is the valid time.

And then it will require you to input the password, your name, … Now go to ‘’ in your android project directory. Add these line into it, you can replace it:

abc: is your name keystore

ERROR HAPPENING HERE: if you’re using windows 64 bits or Linux, it’s fine. But Windows 32 bits, you need to go to ‘K:\Program Files\Android\android-sdk\tools\lib\find_java.bat’ open it by notepad, then go to the line has these:

%sys_32%\reg query "HKLM\Hardware\Description\System\CentralProcessor\0"^
| %sys_32%\find /i "x86" > NUL && set arch_ext=32|| set arch_ext=64

And now add the ‘rem’ to two lines above like this, add this line ‘set arch_ext=32’:

rem    %sys_32%\reg query "HKLM\Hardware\Description\System\CentralProcessor\0"^
rem    | %sys_32%\find /i "x86" > NUL && set arch_ext=32|| set arch_ext=64
set arch_ext=32

8. Final step, build your app with ant

Again go to command line, and move to your directory project android and type.

ant release

It will compile, and wait until finished. Go to project directory\bin You will see the file like this ‘YourTestProject-release.apk’

Now it’s done, you can release it to any device and install it.

Leave a Reply

Your email address will not be published. Required fields are marked *