Tag Archives: developer

How to make an Android development machine on Ubuntu 10.04.3 Long Term Support (LTS) Desktop 32 bit version

To start I must give credit to ‘uzzal’ and his blog “Setup Android Environment on Ubuntu 10.10,” found here http://mynetsys.blogspot.com/2011/02/setup-android-environment-on-ubuntu.html, following the directions there I was able to make my first Android development environment. I made this document in order to fit my needs and update the process with the latest software at the time, other than the OS version; I picked 10.04.3 because of its LTS status.
This document assumes you have or know how to install Ubuntu 10.04.3. So please do this first by any means you know how or can find on the internet. You can download the ISO here http://www.ubuntu.com/download/ubuntu/download by using the drop down in step one. Remember in creating this document I use the “Ubuntu 10.04 LTS – Long-term support” “32-bit (recommended) version of Ubuntu. I also followed this nice step-by-step on how install Ubuntu, http://news.softpedia.com/news/Installing-Ubuntu-10-04-LTS-141550.shtml . If you want to get the same results I show here then start with this version of Ubuntu and follow the install steps found at softpedia. I made a change to the softpedia steps by setting a 2048MB swap partition at the beginning of my disk 10240MB as the first primary partition mounted at ‘/’ and the remaining free space of 52135MB as the next primary partition mounted at ‘/home’.
*Note that this is given as is with no warranty and no guarantee. It is not the intent for these steps to cause issues with your system. With that said, making any modifications to a computer system and or its operating system does have the potential to cause issues. If you break your system while performing these actions it’s at your risk, test on a non-production system first.

Prep:

We are going to download all your needed components first then install them in the order you need.
1. Download Oracle’s Java SE Development Kit (JDK) 7u2 from here http://www.oracle.com/technetwork/java/javase/downloads/jdk-7u2-download-1377129.html if this link no longer works by the time you read this document then do a search for “JDK” and find the latest most “official” looking download location, sorry if Oracle changes things.
2. Download Eclipse IDE for Java Developers, Linux 32 Bit version, from here http://www.eclipse.org/downloads/?osType=linux . At the time of this writing the version is “Eclipse Indigo 3.7.1”, again sorry if things have changed by the time you read this … use Google to find the latest stuff.

Install time:

The Oracle JDK

  1.  You can find a good tutorial on how to install JDK 7u2 here http://askubuntu.com/questions/55848/how-do-i-install-oracle-java-jdk-7. I have given you the steps I used below.
  2.  Open a terminal and “cd” to the directory where you downloaded “jdk-7u<version>-linux-i586.tar.gz” to.
  3.  Type ‘sudo tar zxvf jdk-7u<version>-linux-i586.tar.gz, note use the “TAB” button when typing out long names … it really helps, and make it a habit. This will unpack “install” the JDK to a new sub directory called “jdk1.7.0_<version>” in the current directory.
  4.  Make “jvm” directory under “/usr/lib” by typing ‘sudo mkdir /usr/lib/jvm’.
  5.  Move the” jdk1.7.0_<version>” directory to “/usr/lib/jvm/jdk1.7.0_<version>” by typing ‘sudo mv ./jdk1.7.0_<version> /usr/lib/jvm’.
  6.  Now run:
    1. sudo update-alternatives –install “/usr/bin/java” “java” “/usr/lib/jvm/jdk1.7.0_<version>/bin/java” 1
    2. sudo update-alternatives –install “/usr/bin/javac” “javac” “/usr/lib/jvm/jdk1.7.0_<version>/bin/javac” 1
    3. sudo update-alternatives –install “/usr/bin/javaws” “javaws” “/usr/lib/jvm/jdk1.7.0_<version>/ 1

The Eclipse development environment:

  1. Open a terminal and “cd” to the directory where you downloaded “eclipse-java-<version>-linux-gtk.tar.gz” chances are it is in the same directory as the JDK .tar file so stay where you are.
  2. Type ‘sudo tar zxvf eclipse-java-<version>-linux-gtk.tar.gz’, note use the “TAB” button when typing out long names … it really helps, and make it a habit.
  3. Move the “eclipse” directory to “/opt/” by typing ‘sudo mv eclipse /opt/’.
  4. Modify the permissions, ACL, for the eclipse folder with
    1.  ‘sudo chmod -R a+r /opt/eclipse’ – This recursively (-R) gives ‘all’ (a) read (+r) permissions on the “eclipse” folder.
    2. ‘sudo chmod a+x /opt/eclipse/eclipse’ – This  makes “eclipse” executable (+x) to all (a).
  5. Now to make an executable in your path
    1. ‘sudo touch /usr/bin/eclipse’ – Makes an empty file in “/usr/bin” called “eclipse”.
    2. ‘sudo chmod  777 /usr/bin/eclipse – Changes the permissions, ACL, to allow everyone full access to the file.
    3. ‘sudo gedit /usr/bin/eclipse’ – Opens the “eclipse” file in “gedit” so you can add some content to it. Here is the content, copy and paste it into “gedit” then save and close it.:#!/bin/sh #export MOZILLA_FIVE_HOME=”/usr/lib/mozilla/” export ECLIPSE_HOME=”/opt/eclipse” $ECLIPSE_HOME/eclipse $*
      Copy and paste it into “gedit” then save and close it.
  6. You will want to run Eclipse no matter where you are so make a symlink to it by typing ‘sudo ln –s /usr/bin/eclipse /bin/eclipse’.
  7. Launching Eclipse from a terminal is fine and all but what if you want to launch it from the “Applications” menu. Well you do this.
    1.  ‘sudo gedit /usr/share/applications/eclipse.desktop’
    2. Copy and paste this: [Desktop Entry] Encoding=UTF-8 Name=Eclipse Comment=Eclipse IDE Exec=eclipse Icon=/opt/eclipse/icon.xpm Terminal=false Type=Application Categories=GNOME;Application;Development; StartupNotify=true
    3. Then you will have to “save as” under “file” and browse to “/usr/share/applications” and name the file “eclipse.desktop”.
    4. Close “gedit”.
    5. Click “Applications” you should now have a section called “Programming” and under that “Eclipse”.
  8. Run Eclipse for the first time by typing in ‘eclipse –clean’
  9. Type or “Browse…” to the directory you wish Eclipse to use as your workspace, or just keep the default and click “OK”.

Install the Android ADT Plugin for Eclipse:

  1. I followed this guide http://developer.android.com/sdk/eclipse-adt.html starting at “Downloading the ADT Plugin.” For your convenience I have the steps below.
    1. Start Eclipse, then select Help > Install New Software….
    2. Click Add, in the top-right corner.
    3. In the Add Repository dialog that appears, enter “ADT Plugin” for the Name and the following URL for the Location: https://dl-ssl.google.com/android/eclipse/
    4. 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).
    5. In the Available Software dialog, select the checkbox next to Developer Tools and clickNext.
    6. In the next window, you’ll see a list of the tools to be downloaded. ClickNext.
    7. 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.
    8. When the installation completes, restart Eclipse.

Install the Android SDK:

  1. Once Eclipse restarts it asks for your workspace again so type or “Browse…” to the directory you wish Eclipse to use as your workspace, or just keep the default and click “OK”.
  2. Next is a very cool new thing that Google has done for us it automatically assumes that you would want to install the Android SDK seeing as you just installed the ADT Plugin. So yes we would like to do that, keep everything as it sits and click “Next>”.
  3. Are you the sharing type? Make up your mind if you want to share usage statistics with Google and then click “Finish”.
  4. Read and accept all the license agreements, then click “Install”.
There you go your all done, now go program that next killer app!!!