Install Android on Ubuntu Linux with Eclipse IDE

This document will prepare an overview of the steps you will take to install and configure Android on your Ubuntu Linux system. You must have Oracle Java JDK or OpenJDK on your system before installing Android SDK. OpenJDK (aka Open Java Development Kit) is a free and open source implementation of the Java programming language Moreover, you will learn how to:

  1. Prepare your development environment and ensure it meets the system requirements.
  2. Install the Android Software Development Kit (SDK)s
  3. Download and Configure the Eclipse Integrated Development Environment (IDE)
  4. Install the Android Development Tool (ADT) Plugin for Eclipse IDE
  5. Add Android platforms and other components to your SDK
  6. Create your Android Virtual Device (AVD)

Steps

Prepare your Development Environment

  1. Prepare your Ubuntu Linux development environment and ensure it meets the system requirements. First, boot up Ubuntu Linux,make sure you have an implementation of the Java JDK installed on your system, whether it is OpenJDK or Oracle Java JDK, which lays the foundation for the Android SDK. If you don't have the Java JDK installed on your system please install it, you can obtain the Oracle Java JDK from Download the Oracle Java JDK,for more information on:
    • How to Install Oracle Java on Ubuntu Linux or to install the OpenJDK and OpenJRE open up a terminal on your system and run the following commands
    • Type/Copy/Paste: sudo apt-get install openjdk-7-jdk
      • This command installs OpenJDK on your system
    • Type/Copy/Paste: sudo apt-get install openjdk-7-jre
      • this command installs OpenJDK JRE( Java Runtime Environment ) on your system
    • You have choice between installing OpenJDK or installing Oracle Java. I strongly recommend installing Oracle Java because it is usually the most well maintained and up to date version of Java.
  2. If you are running a 64-bit distribution of Android SDK on your development machine, you need to install the ia32-libs:
    • Type/Copy/Paste: sudo apt-get install ia32-libs
      • This command installs additional libraries needed for development with the Android SDK
    • Type/Copy/Paste: javac -version
    • this command checks for the Java JDK on your system:
      • It should respond back with:
        • java 1.7.0
        • or something very similar
    • Type/Copy/Paste: java -version
      • this command checks for the Java JRE ( Java Runtime Environment ) on your system

Download and Configure Eclipse Integrated Development Environment (IDE)

  1. You want to make sure you have the Eclipse Integrated Development Environment (IDE) installed on your system,for example select Eclipse Classic, and download the version for your system architecture such as 32bit or 64 bit version for Linux. If your computer system has 4GB or more of memory most likely it is a 64 bit computer. You can tell if your Ubuntu Linux operating system is 32 or 64 bit by opening up a terminal and running the following command:
    • Type/Copy/Paste: file /sbin/init
    • Download Eclipse IDE it will download into your /home/"your_user_name"/Downloads
      • Select the correct bit version for your corresponding system architecture. For example, if you are on 32-bit Ubuntu Linux select 32-bit Eclipse IDE and if you are on 64-bit Ubuntu Linux select 64-bit Eclipse IDE.
  2. This is an example of a 64-bit Eclipse IDE setup on 64-bit Ubuntu Linux operating system.
    • Type/Copy/Paste: cd /home/"your_user_name"/Downloads
      • this will change you in your Downloads directory
    • Type/Copy/Paste: sudo -s cp -r eclipse-SDK-3.7-linux-gtk-x86_64.tar.gz /usr/local
      • this will copy your Eclipse IDE to the /usr/local directory
    • Type/Copy/Paste: cd /usr/local
      • this will change you into the eclipse directory
    • Type/Copy/Paste: sudo -s chmod a+x eclipse-SDK-3.7-linux-gtk-x86_64.tar.gz
      • this command makes the eclipse binaries executable for all on the system
    • Type/Copy/Paste: sudo -s tar xvzf eclipse-SDK-3.7-linux-gtk-x86_64.tar.gz
      • this unpacks your Eclipse IDE compressed binaries
    • Type/Copy/Paste: exit
      • this command takes you out of root user
  3. Open up a terminal and enter the following commands:
    • Type/Copy/Paste: cd /home/"your_user_name"/Desktop
      • this will change you into your user Desktop, make sure you are not root
    • Type/Copy/Paste: ln -s /usr/local/eclipse/eclipse
    • Type/Copy/Paste: chown "your_user_name" eclipse
      • this will make the Eclipse symbolic link located on your desktop belong to the user
      • Important, make sure you are not root when you create this symbolic link from your Eclipse IDE /usr/local/eclipse directory to your Desktop /home/"your_user_name"/Desktop

Download, Install and Configure the Android SDK

  1. Download the Android SDK, click on the Linux tarball, android-sdk_r22-linux.tgz and save it to your /home/"your_user_name"/Downloads directory, open up a terminal and run the following commands:
    • Type/Copy/Paste: cd /home/"your_user_name"/Downloads
      • this will change you into your Downloads directory
    • Type/Copy/Paste: sudo cp -r android-sdk_r22-linux.tgz /opt
      • this will copy the android sdk to /opt
    • Type/Copy/Paste: cd /opt
      • this will change you into the Android working directory
    • Type/Copy/Paste: sudo tar xvzf android-sdk_r22-linux.tgz
      • this will unpack your Android SDK
    • Type/Copy/Paste: sudo -s chmod -R 755 /opt/android-sdk-linux
      • this will make the /opt directory and the Android SDK writable and executable for all users on the system.
  2. When these steps are complete you will have Android SDK located at:/opt/android-sdk-linux on your Ubuntu Linux system.
  3. Also, open up a terminal and add Android SDK to your system wide PATH on Ubuntu Linux
    • Type/Copy/Paste: sudo nano /etc/profile
    • or
    • Type/Copy/Paste: sudo gedit /etc/profile
    • Add the following lines below to the end of the system PATH file
    • Type/Copy/Paste: export PATH=${PATH}:/opt/android-sdk-linux/tools
    • Type/Copy/Paste: export PATH=${PATH}:/opt/android-sdk-linux/platform-tools
  4. Save the /etc/profile file and exit
  5. Reload your system PATH /etc/profile by issuing the following command
    • Type/Copy/Paste: . /etc/profile
      • this informs the Linux system of the location of the Android SDK development tools

Install the Android Development Tool (ADT) Plugin for Eclipse IDE

In order to install the Android Development Tool (ADT), you will have to install the Android ADT tool for the Eclipse IDE as root:

  1. Type/Copy/Paste: sudo -s /usr/local/eclipse/eclipse
    • this will install the ADT plugin tool for all users on the system
  2. Install the ADT Plugin for Eclipse, the ADT is a plugin for the Eclipse IDE. Before you can install or use ADT, you must have a compatible version of Eclipse installed on your development computer. Start Eclipse, then select Help > Install New Software. Click Add, in the top-right corner. In the Add Repository dialog that appears, enter "ADT Plugin" for the Name and the following URL for the Location
  3. Type/Copy/Paste: https://dl-ssl.google.com/android/eclipse/
    • Click OK
    • Note: If you have trouble acquiring the plugin, try using "http" in the Location URL, instead of "https" (https is preferred for security reasons)
  4. In the Available Software dialog, select the checkbox next to Developer Tools and click Next. In the next window, you'll see a list of the tools to be downloaded and Click Next. Read and accept the license agreements, then click Finish.
    • Note: If you get a security warning saying that the authenticity or validity of the software can't be established, click OK.
  5. When the installation completes, restart Eclipse. Configuring the ADT Plugin, after you've successfully downloaded the ADT as described above, the next step is to modify your ADT preferences in Eclipse to point to the Android SDK directory:
    • Select Window > Preferences... to open the Preferences panel
      • Select Android from the left panel. You may see a dialog asking whether you want to send usage statistics to Google. If so, make your choice and click Proceed. You cannot continue with this procedure until you click Proceed.
  6. For the SDK Location in the main panel, click Browse... and locate your downloaded SDK directory, which should be /opt/android-sdk-linux
    • Click Apply, then OK.

Add Android platforms and other components to your SDK

  1. Adding Platforms and Other Component,in setting up your SDK is using the Android SDK and AVD Manager (a tool included in the SDK starter package) to download essential SDK components into your development environment. The SDK starter package, which you've already downloaded, includes only a single component: the latest version of the SDK Tools. To develop an Android application, you also need to download at least one Android platform and the associated platform tools. You can add other components and platforms as well, which is highly recommended.
  2. Open Eclipse and click Window->Android SDK and AVD Manager->Installed packages and click update all. Simply click Install to accept the recommended set of components and install them
  3. On Linux, open a terminal and navigate to the /opt/android-sdk-linux/tools directory in the Android SDK.
    • Type/Copy/Paste: sudo -s
    • Type/Copy/Paste: cd /opt/android-sdk-linux/tools
    • this will change you into the android sdk tools directory
    • Type/Copy/Paste: ./android
    • this command will run the Android graphical user interface, in most cases you will have to be root user in order for the Android SDK to download updated components to the opt/android-sdk-linux directory.To download components, use the graphical UI of the Android SDK and AVD Manager to browse the SDK repository and select new or updated components. The Android SDK and AVD Manager installs the selected components in your SDK environment.

Create your Android Virtual Device (AVD)

  1. Once all the components for Android have been updated you will need to create an Android Virtual Device.
    • Click on Window->Android SDK and AVD Manager->Virtual Devices in order to create an Android Virtual Device ( emulator ).
    • Click New, scroll down to the box that says name and assign an Android Virtual Device name such as: My_AVD
    • Next click on the box that says target and use the arrow button and scroll down and select appropriate Android version you want to develop with such as, Android 3.2-API Level 13.
    • Next scroll down to the box that says Skin and Click on Resolution, enter the numbers 420x580 and select Create AVD, this will create your Android Virtual Device ( emulator ), for program testing.
  2. Congratulations, you should now have the Android SDK setup to work with Eclipse IDE and you can begin developing Android Applications.

Related Articles