Android: Getting Started


The Android Mobile platform has certainly taken the industry by storm. Its got cool features and even though it hasnt got the popularity of a Windows Mobile or Apple’s iOS, its destined to lead the market in a couple of years. For that to happen, Android needs more developers and Engineers to use its API to build applications for the platform enabled devices.

Windows Mobile and iOS also provide API for developers to develop apps and other software. But the thing that sets Android apart is the fact that the ‘Entire Android API’ is available in the public domain. What I mean is as a developer, you can use the exact same stuff that was used to develop the core Android OS to develop your applications for the Android powered devices. That means you have access to each and every component of the device. From the touch screen to the Accelerometer, from the Camera to the Proximity sensor and from Google maps to GPS devices. You can do anything with your apps. And another advantage is that Android uses Java Programming language. You just need to use the Android packages to build your applications and Android uses a similar Virtual Machine to run its applications like the highly popular JVM. So it shares most of the features of the Java platforms. The best feature is the Platform Neutral Development. You can start developing Android apps with whatever OS you use. Be it Windows, Macintosh or Linux etc. And it has got the backing of Google too. What more do you want?

I was one of those programmers who thought Android development would be very tough. But I saw one of my friends developing an app and and only then I realized the ease of creating Android Application. Fortunately the Eclipse IDE (by far the best IDE to build Java apps) supports Android development and makes it very easy. All you need to do is install a plugin from Google (License holders of Android).  And for testing your Android applications you dont need an Android device. You can use the innovative Android Emulator (Android Virtual Device) to run and test your applications. So I decided to write this article to provide all the stuff you will need to setup your Software Infrastructure needed to get started with your Android Adventure!

1. First of all, since you’re gonna work with Java, you need the latest version of Java SE SDK. At the time of writing this article, the latest version of the JDK (Java SDK) was JDK 1.6.0_26. So you can get this from Sun’s website. Download the the JDK for your platform (OS) from the following link:

http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u26-download-400750.html

After downloading the JDK, install it. Installation is pretty straight forward. You should be able to install it easily. But If you couldn’t install the JDK, brother, computer Science isn’t your field. You can try Management or something like that. Lol! Just kidding. If you face any problems just leave a comment here and Ill try to help. Or you could also open a thread at the Sun Java Support forums and there are lots of experts who would be more than happy to lend a helping hand. So don’t worry!

2. Now that you’ve got the JDK installed in your computer, we need to get the Android SDK (ADK) installed. Android SDK can be obtained from Android’s website for developers, which is developer.android.com. Its a great website to know more about Android Application development. Its very user-friendly. You can download the SDK from the following link. Choose the SDK for your platform.

http://developer.android.com/sdk/index.html

Windows users who download the exe version should be able to install the SDK easily. But if you downloaded the zip version for Windows and Mac or the tgz file for the Linux, then just extract the contents of the archive to a location in C: Drive. It would be better if you could place it in Program Files (in case of Windows) because thats where your Java is also installed.

3. Now that you have installed the SDK, you have to add Platform tools, Documentation and most important of all, the Android APIs for various Android platforms. At the time of writing this article the latest platform version was Android 3.1. Selecting a proper Platform is crucial because you need to develop the application for an Android device using the API of the Android platform that the device is using. (i.e) If you are developing an app for Android 1.6 device, you need to have the Android 1.6 API installed and you need to use this to develop your app.

So now you need to download the required platform APIs for the SDK. This is very easy to do. Now navigate to the directory where you extracted/installed the Android SDK. Inside the directory, you’ll find an executable called ‘SDK Manager.exe’  Double click it. Now you’ll see a window that searches the various repositories and finds the latest stuff available for you. After searching you should get a window something like this…

Now this window shows the latest stuff available for you. This may look confusing and very uncomfortable considering the fact that you’re just starting out. So press cancel and close the window. Now you’ll have the main SDK manager Window. In this window, on the left pane, you will see  5 options – Virtual Devices, Installed Packages, Available Packages, Settings and About. Dont get confused about all these options. We’ll come to them later. Now to see the available packages for download, select “Available Packages” option. If you do it, you will see two categories in the centre pane like this…

Now these two categories represent the two groups of API and tools available to you. One is Android Repository which contains the Platform APIs and other tools offered by Android. And the next option, 3rd Party Add-ons contains API and tools provided by 3rd party Companies like Samsung, Sony, Google (well, not exactly third-party. But still a separate entity from Android) etc. Expand them and see what they offer for you. You should get the following stuff…

Now you can select the platforms and tools you need. Now if you find it difficult to choose the required stuff, Ill suggest some for a start.

Make sure you select the following stuff:

  1. Android SDK tools r11
  2. Android Platform Tools
  3. Documentation for Android SDK, API 12, r1
  4. Any number of Android Platforms you need
  5. Select the sample codes for whatever API version you chose in the previous step
  6. Now, under the Third Party section, Google provides some APIs. These APIs allow you to add proprietary Google features like the Google Maps service in your app. So if you want to add that functionality to your apps, select the required Google API.
  7. You can also use APIs of other device makers like Sony, Samsung and LG.

Now All you have to do is press the Install Selected Button. After pressing that button, you will get a window exactly similar to the one you got when you started the SDK Manager Application. In this window, you will see all the stuff that you selected. Now I’ve selected some tools and platforms for me and it is showing the ones that I selected. Now you need to accept the Package License Agreement. If you want to read all the Package information select the package and the details for that package will be displayed in the center section. Now Select Accept All Radio button and select install. Now it should automatically start downloading the selected items and Install them to your computer. After Installing you can press the Close button in the “Download Window”. And then you can close the SDK Manager.

4.  Let us now install the eclipse IDE in your computer. If you already have the latest version, you can skip this step and proceed to step 5. Eclipse is a free IDE for Java development. But they also provide IDEs for many other languages. But what we need is an IDE for Java. Lets go get it! Use the following link:

http://www.eclipse.org/downloads/packages/eclipse-ide-java-developers/heliossr2

Dont get confused by the stuff given in this page. All you need to see are the links on the right side pane of the page. You will see links for Windows 32 bit, 64 bit, Mac and Linux. Select the version according to your platform. You will be taken to another page that will provide the download links. On this page you will see a big Down Arrow button. Click it and the download should start. If you prefer downloading via bit-torrent. Select the bit-torrent option and a .torrent file will be downloaded. Use it to download the IDE. The IDE comes ‘packaged’ in an archive. Extract it to the required directory. You need to do any Installation. Now you’ve got yourselves a proper Java IDE.

5. Eclipse IDE has been the benchmark for all Java IDEs and none of the other IDEs have come close to the Eclipse. Its sleek, user friendly, powerful and provides feature filled debugging options. One of the best things that happened for the Android developers is the introduction of the Android Development Tool (ADT) for Eclipse IDE. This tool allowed developers to create, test and deploy their Android apps using the Eclipse IDE. So let us download this plug in for Eclipse.

This plug in is downloaded through Eclipse itself. Go to the directory where you extracted Eclipse and run the eclipse.exe file. Now if this is the first time you are running the IDE, it will ask you to set a default working directory (i.e) the folder to store all your project files. Id recommend creating a folder for Android apps and set default Working Directory as that directory so that you can easily and conveniently save our projects. This directory can be changed any time and also you can save your projects anywhere you wish. Lets get down to business. After the IDE loads you will see the the IDE window with all sort of “complex” panes and options. Please dont get discouraged by all this. Its very simple to use actually. Once you develop one or two applications using Eclipse, you will start to love it. So now, select Help -> Install New Software

You will get a window like the one below.

Now near the text box that’s present on the top portion of the window, you will see a Button called “Add”. Press it. And you will see a window like the one below.

Now add the following data to the two fields:

Name:  ADT Plugin

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

Press OK.  In the Available Software section, you will see a check box near Developer Tools. Select it and click Next.  In the next window, you’ll see a list of the tools to be downloaded. Review it and click next. And in the next window, there will be license agreements. Read (lol) it and press Finish. When I pressed finish, I got a message asking to verify validity of the software being downloaded. Verify it proceed. Now download and installation will start. When the installation completes, restart Eclipse.

Great! Now we have setup everything needed to start developing. But wait, where do you test the applications you develop? You could do it on your phone. But if you dont have an Android phone dont worry. We have a facility to create a Virtual Device that emulates an Android phone!

Lets see how to create one:

Open the SDK Manager from the directory where you extracted the Android SDK. When you open it you will shown the list of available tools and platforms as you were shown earlier. Cancel that window and get to the main window, on the left pane select Virtual Devices. Now on the right pane you will see the list of Android virtual devices already created. Since we haven’t created one, it will be empty. Now press the “New” button on the right side. Now you will see a window where you can add whatever feature you want on your virtual device. And you can even select the SD card size, Display Size and most importantly the platform that the Virtual Device will run. So select all the options you need. You can select the Platform to use from the Target drop down box. Select appropriate display size. Now to add various hardware features, click new in the Hardware Section and you will see a whole host of hardware features. Select the one you need and set its property by double clicking it and selecting the value.

I have selected the options for creating an Android Virtual device that runs Android 1.5 with 512 MB SD Card and HVGA display and with D-Pad, Touch Screen and Camera. Its important to choose the options to mimic the device for which you are developing the application.

Finally Press Create AVD. You will get a confirmation window and you will see that the newly created Virtual Device in the list of Virtual Devices. Now to test drive the newly create device, select it and press the start button. You will see a window that asks you to scale display options or to wipe previous usage data. Just press Launch to Start the device. And Voila! Your very own Android Device! The device will behave exactly like a real mobile phone. That means you will have to go though the slow booting process of a smart phone. Enjoy!

Well, we have come to the end of the tutorial. I have given you all that you would need to start developing your very own apps for Android. There are a lot of books available for you to study Android programming.

One of the best books for amateurs and novices is Android Application Development For Dummies by Donn Felker. If you want a pdf of the book, drop a comment below or contact me via twitter @stevanity

You will find Android Development easy, adventurous and interesting. Well, thats what Android is all about. The Eclipse IDE supports android development comprehensively. From project creation to running the project, it will provide you with a very user-friendly workflow. You can publish your apps online and if your very serious about developing apps, you can get an account at Android App store for something like $25 and you can publish your apps, so that people can buy it. Show your creativity and skill to the world!

As always, if you have any doubts, suggestions etc just drop a comment. And If you like this article share it on Facebook, twitter, etc using the share buttons below.

Thank you,

Steve Robinson

8 thoughts on “Android: Getting Started

  1. Pingback: We’ve hit 5000! « Footy 'n' Tech

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s