Getting Started

Linux Android Setup


Java is the programming language mainly used to develop android applicaitons. As a result, the Java Development Kit (JDK) is the first component that must be installed.

Linux JDK Installation

Firstly, if the chosen development system is running the 64-bit version of Ubuntu then it is essential that the 32-bit library support package be installed:

sudo apt-get install ia32-libs

JDK for linux can be found here It is available as a tar archive for most linux distributions. To install the tar archive follow these steps :
1. Create the directory into which the JDK is to be installed (for the purposes of this example we will assume /home/demo/java).
2. Download the appropriate tar.gz package from the Oracle web site into the directory.
3. Execute the following command (where is replaced by the name of the downloaded JDK file): tar xvfz {jdk-file}.tar.gz 4. Remove the downloaded tar.gz file. 5. Add the path to the bin directory of the JDK installation to your $PATH variable. For example, assuming that the JDK ultimately installed into /home/demo/java/jdk1.7.0_45 the following would need to be added to your $PATH environment variable: /home/demo/java/jdk1.7.0_45/bin This can typically be achieved by adding a command to the .bashrc file in your home directory (specifics may differ depending on the particular Linux distribution in use). For example, change directory to your home directory, edit the .bashrc file contained therein and add the following line at the end of the file (modifying the path to match the location of the JDK on your system): export PATH=/home/demo/java/jdk1.7.0_45/bin:$PATH Having saved the change, future terminal sessions will include the JDK in the $PATH environment variable.

Download the Android Studio Package

Android Studio may be downloaded from here

Installing Android Studio

Having downloaded the Linux Android Studio package, open a terminal window, change directory to the location where Android Studio is to be installed and execute the following command: unzip /{path to package}/android-studio-ide-{version}-linux.zip Note that the Android Studio bundle will be installed into a sub-directory named android-studio. Assuming, therefore, that the above command was executed in /home/demo, the software packages will be unpacked into /home/demo/android-studio.

To launch Android Studio, open a terminal window, change directory to the android-studio/bin sub-directory and execute the following command:

./studio.sh

Android Studio Setup Wizard

The first time that Android Studio is launched after being installed, a dialog will appear providing the option to import settings from a previous Android Studio version. If you have settings from a previous version and would like to import them into the latest installation, select the appropriate option and location. Alternatively, indicate that you do not need to import any previous settings and click on the OK button to proceed.

After Android Studio has finished loading, the setup wizard will appear as shown below

Click on the Next button, choose the Standard installation option and click on Next once again. On the license agreement screen, select and accept each of the licenses listed before clicking on Finish to complete the setup process. The Welcome to Android Studio screen should then appear:

Installing the Latest Android SDK Packages

The steps performed so far have installed Java, the Android Studio IDE and the current set of default Android SDK packages. Before proceeding, it is worth taking some time to verify which packages are installed and to install any missing packages.

This task can be performed using the Android SDK Manager, which may be launched from within the Android Studio tool by selecting the Configure -> SDK Manager option from within the Android Studio welcome dialog. Once invoked, the SDK Manager tool will appear as

Within the Android SDK Manager, make sure that the check boxes next to the following packages are listed as Installed in the Status column:
Tools > Android SDK Tools
Tools > Android SDK Platform-tools
Tools > Android SDK Build-tools
SDK Platform (most recent version)> SDK Platform
SDK Platform (most recent version) > ARM EABI v7a System Image
Extras -> Android Support Repository
Extras > Android Support Library
Extras -> Google Repository
Extras -> Google USB Driver (Required on Windows systems only)
Extras > Intel x86 Emulator Accelerator (HAXM installer)

In the event that any of the above packages are listed as Not Installed, simply select the checkboxes next to those packages and click on the Install packages button to initiate the installation process. In the resulting dialog, accept the license agreements before clicking on the Install button. The SDK Manager will then begin to download and install the designated packages. As the installation proceeds, a progress bar will appear at the bottom of the manager window indicating the status of the installation.

Once the installation is complete, review the package list and make sure that the selected packages are now listed as Installed in the Status column. If any are listed as Not installed, make sure they are selected and click on the Install packages… button again.

Making the Android SDK Tools Command-Line Accessible

On Linux this will involve once again editing the .bashrc file. Assuming that the Android Studio bundle package was installed into /home/demo/Android/sdk, the export line in the .bashrc file would now read as follows:

export PATH=/home/demo/java/jdk1.7.0_10/bin:/home/demo/Android/sdk/platform-tools:/home/demo/Android/sdk/tools:/home/demo/android-studio/bin:$PATH

Note also that the above command adds the android-studio/bin directory to PATH variable. This will enable the studio.sh script to be executed regardless of the current directory within a terminal window.