Complete Installation Guide for Android SDK / ADT Bundle on Ubuntu

What all needs to be done to install Android SDK / ADT Bundle on Ubuntu?

Each of the steps in the answer was found on some different forum as I encountered obstacles getting started with my Android SDK and posted questions in appropriate forums thereafter. So I thought this would be useful in that it is a one stop solution available, in case one ever needs to re-install Ubuntu and install the Android SDK / ADT Bundle from scratch!


Actually, I think you should use Android Studio to develop android application. However, if you have your reason to use eclipse, you can follow the following guide.

Target     : Super Newbies
IDE        : Eclipse
Description: Provide a GUI method to install Android IDE using Eclipse

1. Installing Java Runtime (JDK) and Eclipse IDE

  • Search Software on Ubuntu and launch Ubuntu Software Center

    Searching

  • Search Java on Ubuntu Software Center and then install the OpenJDK Java Runtime.

    enter image description here

  • Search Eclipse on Ubuntu Software Center and then install it.

    enter image description here

  • If you have successfully installed eclipse and JDK, it will appear in the search result on your computer.

    enter image description hereenter image description here

  • For the JDK, you can also press CTRL + ALT + T to open a terminal and type command java -version to check again.

    enter image description here

  • Tips : Lock the eclipse icon on launcher.

    enter image description here


2. Downloading SDK

  • Go to http://developer.android.com/sdk/index.html to download the latest version of SDK. enter image description here

  • Scroll down and click DOWNLOAD FROM OTHER PLATFORMS enter image description here

  • Click android-sdk_r22.6.2-linux.tgz under Linux 32 & 64-bit of SDK Tools Only.

    enter image description here

  • Tick I have read and agree with the above terms and conditions and click Download android-sdk_r22.6.2-linux.tgz.

    enter image description here

  • Wait for the download process.

    enter image description here


3. Preparing for Installation

  • Go to the location where you set to download the file.
  • Rigth click the file[.tgz] and select Extract Here.

    enter image description here

  • Now you can see that a file called android-sdk-linux appears as if the following.

    enter image description here

  • Enter the folder android-sdk-linux.

    enter image description here

  • Enter the folder tools and then copy the folder location.

    enter image description here

  • Press the keys CTRL + ALT + T to open a terminal and then use the following command. Where /home/casper/Downloads/android-sdk-linux/tools is the location I copied previously. You can just type cd and right click to past the location to the terminal.

        cd /home/casper/Downloads/android-sdk-linux/tools
        ./android
    

    enter image description here

  • Now the Android SDK Manager will be run.


4. Installing Packages

  • Click Install [Number] packages....

    enter image description here

  • Click Accept License and then click Install.

    enter image description here

  • Wait for the installation process.

    enter image description here

  • Finally, this message will be shown.

    enter image description here


5. Editing ".bashrc"

  • Press CTRL + ALT + T to open a new terminal and type : gedit ~/.bashrc

    enter image description here

  • Now the following text will appear.

    enter image description here

  • Add the following to the top of the entire text and then save it. (Do not close the file)

        export PATH=${PATH}:~/android-sdk-linux/tools
        export PATH=${PATH}:~/android-sdk-linux/platform-tools
    
  • Example :

    enter image description here

  • [Recommended] Move the whole file android-sdk-linux to your eclipse's workspace and under a folder that you create named Android. Moreover, you have to copy the location.

    enter image description here

  • Now back to the ".bashrc" file and the replace the '~' with the location you copied previously and then save it and close it.

    enter image description here

  • Logout and relogin your Ubuntu system.


6. Setting Up an Android Virtual Device

  • Press CTRL + ALT + T and type android avd to open the Android Virtual Device Manager.

    enter image description here

    enter image description here

  • Click New.... Set up like the following and click OK.

    enter image description here

  • Click your virtual device and then click Start....

    enter image description here

  • Click Launch.

    enter image description here

  • Launching your virtual device enter image description here


7. Installing ADT Plugin on Eclipse

  • Start Eclipse and go to Help -> Install New Software...

    enter image description here

  • Click Add....

    enter image description here

  • Type the following and then click OK.

     Name     :    ADT Plugin
     Location :    https://dl-ssl.google.com/android/eclipse/
    

    enter image description here

  • Tick the checkbox of Developer Tools and then click Next>.

    enter image description here

  • Click Next>.

    enter image description here

  • Click "I accept the..." and click Finish.

    enter image description here

  • Wait for the installation process.

    enter image description here

  • Restart eclipse.

    enter image description here

  • Click Open Preferences.

    enter image description here

  • Copy your own SDK location (The location of the file android-sdk-linux).

    enter image description here

  • Paste to the SDK Location: textbox and then click Apply and OK.

    enter image description here

  • Enjoy to create any android application with your Ubuntu.

    enter image description here


Step 1

Check in System Settings -> Details, whether your Ubuntu is 32-bit or 64-bit


Step 2

(Using software centre or command lines) If your Ubuntu is a 32-bit OS then install libgl1-mesa-dev

In case of 64-bit OS install ia32-libs (Ubuntu 13.04 or earlier), or libgl1-mesa-dev:i386 (Ubuntu 13.10 and above)


Step 3

Install openjdk-8-jdk. If not compatible try openjdk-7-jdk, or if still not compatible openjdk-6-jdk


Step 4

Download the Android SDK command line tools here (they're located at the bottom of the page) and unzip it to a place where you can leave it as long as you need the Android SDK, /opt/ for instance.


Step 5

Check that the unzipped ADT Bundle folder (or Android SDK folder, as the case may be) have the folders tools and platform-tools. If platform-tools folder is absent, you should be able to install it from the android virtual device manager, which can be run by typing the command

   android

in the terminal. These folders contain some important commands stored. Add them to your executable path. Adding them to the path can be done as follows:

First execute gedit ~/.pam_environment. A file opens. Just add these lines to that file:

   PATH DEFAULT=${PATH}:/path/to/tools
   PATH DEFAULT=${PATH}:/path/to/platform-tools

Here you have to replace /path/to/tools and /path/to/platform-tools by the absolute paths according to where you unzipped the SDK or the ADT bundle download. Now all the commands adb, android, emulator etc can be simply executed in the terminal without giving absolute paths. That is, you will not get a "command not found" error if you gave it without its absolute path.


Step 6

Type android into the terminal and, if Step 5 was done correctly, the Android SDK Package Tool will start, where you can finish your installation.


This may seem to be a long answer, but I tried to explain every step as detailed as possible so nothing can go wrong. You can set this up in less than 5 minutes, even as a beginner.


  1. You'll need Java to use Eclipse, so install it first:

    Eclipse is an IDE. The Android ADT package is being bundled with the Eclipse IDE by default. You can also choose to use another IDE (for example NetBeans) if you prefer, but because Eclipse is the default I'll cover only Eclipse in this tutorial.

    1. Open a terminal

      Search for it in your Dash or press CTRL + ALT + T

      Terminal

    2. Execute the following commands:

      sudo apt-get update
      sudo apt-get install openjdk-7-jdk
      

      Check if you see any errors on your screen, then continue.

  2. Now download the Android ADT bundle (this is Eclipse + the Android SDK):

    1. Click here to go to the download page.
    2. Click on Download the SDK (ADT Bundle for Linux)
    3. Check I have read and agree with the above terms and conditions
    4. Select your architecture:

      How can I check this?

      • Check 32-bit if you've a 32-bit Ubuntu
      • Check 64-bit if you've a 64-bit Ubuntu
    5. Click on Download the SDK ADT Bundle for Linux
  3. Install the Android ADT bundle:

    1. Open the .zip file you've just downloaded
    2. Extract all files to a directory, for example:

      ~/ADT
      

      After extraction this directory should contain 2 other directories:

      ~/ADT/eclipse
      ~/ADT/sdk
      
  4. Add the platform-tools binaries to your $PATH:

    This is not neccesary, it'll make commands like adb accesible from a terminal.

    1. Open a terminal
    2. Execute the following command:

      nano ~/.profile
      
    3. Add the following line on top:

      PATH="$HOME/ADT/sdk/platform-tools:$PATH"
      
    4. Save the file

      You can do this by pressing CTRL + X, Y, ENTER

  5. Create a shortcut in your Dash to easily launch the ADT:

    1. Open a terminal
    2. Execute the following command

      nano ~/.local/share/applications/adt.desktop
      
    3. Paste this:

      This can be done by right cliking inside your terminal window and then click Paste.

      [Desktop Entry]
      Version=1.0
      Name=Android ADT
      Comment=Launch the Android ADT
      Exec=/home/username/ADT/eclipse/eclipse
      Icon=/home/username/ADT/eclipse/icon.xpm
      Terminal=false
      Type=Application
      Categories=Development;IDE;
      

      Note: Replace username by your username. You can get your username by executing whoami in a terminal.

    4. Save the file
    5. Execute the following command to make it executable:

      chmod +x ~/.local/share/applications/adt.desktop
      

If you've done everything right you've now succesfully installed the Android ADT. Open your Dash and search for ADT. Click on Android ADT to check if it's working!