How to Install Android SDK? (for Linux) - WOSTWARELD


Saturday, December 17, 2016

How to Install Android SDK? (for Linux)

This tutorial will prepare you 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. You can download Oracle Java JDK from here. Now, follow these 6 steps to install Android SDK on Linux operating system.

Step 1

  • 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. You have choice between installing Open JDK or installing Oracle Java. I recommend installing Oracle Java because it is usually the most well maintained and up to date version of Java. Type this command "sudo apt-get install openjdk-7-jre". This command installs OpenJDK JRE( Java Runtime Environment ) on your system.
  • If you are running a 64-bit distribution of Android SDK on your machine, you need to install the ia32-libs. The command (sudo apt-get install ia32-lib) will install additional libraries needed for development with the Android SDK and the command (javac -version) will check the Java JDK on your system. The Java JDK command must respond back with java 1.7.0 or something similar to this. The command (java -version) will check the Java JRE ( Java Runtine Environment ) on your system.

Step 2 

  • 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.
  • The command (file /sbin/init) will download the Eclipse IDE 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.
  • This is an example of a 64-bit Eclipse IDE setup on 64-bit Ubuntu Linux operating system. The command (cd /home/"your_user_name"/Downloads) will change you in your Downloads directory. The command (sudo -s cp -r eclipse-SDK-3.7-linux-gtk-x86_64.tar.gz /usr/local) will copy the Eclipse IDE to the /usr/local directory. The command (cd /usr/local) will change you into the eclipse directory. Then, the command (sudo -s chmod a+x eclipse-SDK-3.7-linux-gtk-x86_64.tar.gz) will make the eclipse binaries executable for all on the system. Now, the command (sudo -s tar xvzf eclipse-SDK-3.7-linux-gtk-x86_64.tar.gz) will unpack your Eclipse IDE compressed binaries and the command (exit) will take you out of root user.
  • Open up a terminal and enter the command (cd /home/"your_user_name"/Desktop) which will
    change you into your user Desktop, make sure you are not root. Now the command (ln -s /usr/local/eclipse/eclipse) and (chown "your_user_name" eclipse) will make the Eclipse symbolic link located on your desktop belong to the user. It is very important to make sure that 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

Step 3

  • 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. Now, open up a terminal and the command (cd /home/"your_user_name"/Downloads) will change you into your Downloads directory. The command (sudo cp -r android-sdk_r22-linux.tgz /opt) will copy the android sdk to /opt. The command (cd /opt) will change you into the Android working directory. Now, the command (sudo tar xvzf android-sdk_r22-linux.tgz) will unpack your Android SDK and the command (sudo -s chmod -R 755 /opt/android-sdk-linux) will make the /opt directory and the Android SDK writable and executable for all users on the system. When these steps are complete you will have Android SDK located at: /opt/android-sdk-linux on your Ubuntu Linux system.
  • Open up a terminal and add Android SDK to your system wide PATH on Linux. Type the command (sudo nano /etc/profile) or (sudo gedit /etc/profile). Now add the following lines below to the end of the system PATH file.
    • export PATH=${PATH}: /opt/android-sdk-linux/tools
    • export PATH=${PATH}: /opt/android-sdk-linux/platform-tools
    • Save the /etc/profile file and exit.
  • Now, reload your system PATH /etc/profile by using the command (. /etc/profile). This command informs the Linux system of the location of the Android SDK development tools.

Step 4

  • In order to install the Android Development Tool (ADT), you will have to install the Android ADT tool for the Eclipse IDE as root. The command (sudo -s /usr/local/eclipse/eclipse) will install the ADT plugin tool for all users on the system.
  • 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 system. Start Eclipse, then select Help and 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 URL ( for the Location. Now, click OK. If you have trouble acquiring the plugin, try using "http" in the Location URL, instead of "https" (https is preferred for security reasons).
  • 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. If you get a security warning saying that the authenticity or validity of the software can't be established, click OK.
  • When the installation completes, restart the Eclipse. Configuring the ADT Plugin, after you've successfully downloaded the ADT as described above.
  • Now, modify your ADT preferences in Eclipse to point to the Android SDK directory as given below:
    • 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.
  • 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.

Step 5

  • Adding Platforms and other components, 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.
  • 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.
  • On Linux, open a terminal and navigate to the /opt/android-sdk-linux/tools directory in the Android SDK. Type the command (sudo -s) and (cd /opt/android-sdk-linux/tools) to change you into the android sdk tools directory. The command (./android) 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 GUI (Graphical User Interface) of the Android SDK and AVD Manager to browse the SDK repository and select the new or updated components. The Android SDK and AVD Manager installs the selected components in your SDK environment.

Step 6 

  • 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 a Android Virtual Device ( emulator ).
  • Click on Window->Android SDK and AVD Manager->Virtual Devices in order to create a Android Virtual Device ( emulator ).
  • Now, 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.
  • Now, 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.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.