As a Windows user for more than a decade, shifting to Ubuntu 12.04 was never an easy task. However, with a bit of tenacity, starting from ‘googling’ every command to making a public note on how to get about doing a certain thing (in short, blogging about it), things have become smoother. I recently had to install Android on my Ubuntu 12.04 from scratch (and I mean real scratch!! ). And since a terminal is the fastest way to do it (and lets admit it …makes you feel smug and nerdy) , I followed the same route .
So, I am jotting down the steps I followed here to serve as a future quick cheat-note for myself and other nascent Ubuntu users. ( P.S : Its so much easier than remembering and searching again ! ) Hope it helps you also in some way , however tiny it be.
Note : This post is not for advanced Ubuntu users. It is for linux newbies (or previous windows users) like me , who would prefer some directions involving low amounts of linux jargon.
Basically it involves 5 major steps : Locating terminal -> installing pre-requisites for java and eclipse -> installing eclipse -> installing SDK -> installing Android plugin (ADT) for Eclipse. They are described in detail below.
1. Getting started : Locating the terminal
Open dash home (on the left hand panel ) -> in the search field of window that opens, type ‘terminal’ . Clicking on the result option, will open a terminal window.
2. Prerequisites for eclipse : Java + 32-bit lib (optional). If you are running a 64 bit version of Ubuntu, you need to have a library of 32-bit for installing java. To install it , run in terminal, sudo apt-get install ia32-libs .
On the terminal window, check if you already have a java lib. Typing ‘java -version’ gives you the version of java already installed, if any. After Oracle took over Sun, java6 is no longer supported. Thus trying to run sudo apt-get install sun-java6-jdk raises an error . Sun’s JDK is now supported by Oracle as OpenJDK . To install that run command sudo apt-get install openjdk-6-java .
3. Downloading Eclipse: For the uninitiated, there is no such thing as ‘installing’ Eclipse. All you need to do is download the version you want, extract it and run it. The versions of eclipse are named as Ganeymede (3.4) -> Galileo(3.5) -> Helios(3.6) -> Indigo(3.7) -> Juno(4.2).
4. Installing Android SDK: Android SDK contains many modules , which can be added to Eclipse and used for developing android apps. The Android SDK (SDK being an acronym for Software Development Kit) can be downloaded (as a *.tgz file), unpacked and extracted to a folder in a safe location. The path of this location will be required later on, so its better if you make a note of it now. For extracting the SDK in terminal , type tar -xzvf <name.tgz> .
Note : In case you have extracted in a different folder, copy it from to the destination folder using : cp <source-pathname> <destination-pathname>. Regular windows users need to note that the ‘\’ in pathname should be replaced by ‘/’ to be recognized in Ubuntu (and its other flavors).
Now in terminal tools/ directory in the Android SDK, then type ./android sdk for executing it .
Click on modules tools and latest Android API (at the moment 4.1). The modules you checked now for installation are :
- SDK Tools. Required. Your new SDK installation already has the latest version. Make sure you keep this up to date.
- SDK Platform-tools. Required. You must install this package when you install the SDK for the first time.
- SDK Platform. Required.You need to download at least one platform into your environment so you’re able to compile your application.
- System Image. Recommended. It’s a good practice to download a system image for each version of Android you support and use them to test your app on the Android emulator.
- SDK Samples. Recommended.
- Android Support. Recommended. The APIs available in this static library allow you to use a variety of new framework features (including some not available in even the latest version) on devices running a platform version as old as Android 1.6. For more information, read Support Library.
5. Installing ADT ( Android Development Tool). This is the eclipse plugin for developing Android in Eclipse. It is recommended that Eclipse – Helios version is used as the IDE. Start Eclipse by clicking on the light blue rhomboid icon named eclipse in the extracted folder. Its better to create a shortcut for the icon on the desktop for quicker access. Once eclipse starts, go to the tab Help -> Install New Software. Click the Add button. This pops up a dialog box which requires a name and a url address from where it can fetch the plugin. In name , enter ADT plugin and in url enter https://dl-ssl.google.com/android/eclipse/ .
Out of the modules that come up for installation , click on Developer Tools. Keep clicking next till it finish button comes up.
Note: Eclipse may give a warning in between stating that the content to be added is unsigned and hence unsafe. It is okay to ignore it and go ahead. Since the android plugin is from its makers google itself (obvious from the URL itself), I guess they just didn’t bother to sign it.
When Eclipse restarts, it will ask for installing a new SDK or using an existing one. We have already installed our SDK in step 4 , and thus will click the option for using existing directory. Browse to the directory path of android-sdk-linux folder in the existing SDK option.
Thats it !! We are done with installations and are all set to build a demo ‘Hello World’ android App. The tutorial here explains how to go about it. Also for a complete reference and guide to android, click here . For eclipse and java , click here. It is a compilation of tutorials for beginners in java and eclipse.