Setup Ubuntu for Android Development
Install Android SDK
First, we need to download and install the Android Software Development Kit (SDK). The SDK is available at http://developer.android.com/sdk/index.html and Select the Linux 32 & 64-bit
package under the SDK Tools Only
.
Now that the package is downloaded, extract it. This will create the android-sdk-linux
in your home folder.
Fixing PATH variable
In order for the android SDK to work properly, you need to add the new paths folders to your PATH variable.
- $HOME/android-sdk-linux/tools
- $HOME/android-sdk-linux/platform
- $HOME/android-sdk-linux/platform-tools
vi ~/.profile
Add the following line at the bottom of the file:
PATH="$HOME/android-sdk-linux/tools:$HOME/android-sdk-linux/platforms:$HOME/android-sdk-linux/platform-tools:$PATH"
This will work next time you log in to your session. If you want to make these changes effective in your current session, you can run this command:
export PATH="$HOME/android-sdk-linux/tools:$HOME/android-sdk-linux/platforms:$PATH"
Installing JAVA
Android application works with Java. You will need to install it.
sudo apt-get install openjdk-7-jdk ant
Verify the installation
Let's make sure Java and the SDK is properly installed before we continue.
You can easily check Java by checking the current version installed.
java -version
This will output something like this:
java version "1.6.0_33" OpenJDK Runtime Environment (IcedTea6 1.13.5) (6b33-1.13.5-1ubuntu0.12.04) OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode)
Now let's make sure the Android package is working as well.
android
This will open a window. This window will allow you to get specific packages, add and update existing packages etc.
Go ahead and install the API 21 (and others if you want).
Android Debug Bridge Package
The Android Debug Bridge (adb) is a tool that allows you to communicate with an emulator or a connected Android-powered device.
To install adb, simply run this command.
sudo add-apt-repository ppa:nilarimogard/webupd8 sudo apt-get update sudo apt-get install android-tools-adb android-tools-fastboot
If you are on a 64bit system, you also need to install the following two packages:
sudo apt-get install lib32stdc++6 ia32-libs