Saturday, April 20, 2013

Setting up your development environment

Before you start, it is essential to setup your application development environment. You would require a computer running Windows/MAC/Linux based OS. I use Ubuntu 12.04 LTS for Android application development. You would also require an IDE (Integrated Development Environment) for writing, compiling and debugging your code.

Eclipse is a standard IDE and is very popular among Android developers. It is freely available on the Internet. Eclipse builds a complete project hierarchy for you (along with the skeleton app) and simplifies project  creation up to great extent. It is highly recommended for beginners as Eclipse also points out semantic errors and provides a list of 'Quick Fixes' which may come handy to all lazy developers (like ctrl+shift+o imports all missing classes).

The second thing is the Android SDK tools. It is a massive collection of Android APIs (Application Programming Interface) and developers' tools which you can use for application development.
The third one is Eclipse ADT (Android developers tool) plugin. This will make your life easier.. much easier! You can run your Android application either on a real device (I will tell you how) or on an Android Emulator (commonly known as Android Virtual Device or AVD). You can create an Android emulator on your computer for testing your applications using a special package- AVD manager. AVD manager comes bundled with ADT plugin for Eclipse.

Fig 1.4 Android Developer Tool
Google provides a complete bundled package of Eclipse, SDK tools and ADT plugin in the form of ADT Bundle. So, you don't need to download each one separately and configure them one by one (though you have an option to do that). With a single download, you can obtain all relevant

tools for Android development. ADT bundle includes:
a. Eclipse + ADT plugin
b. Android SDK Tools
c. Android Platform-tools
d. The latest Android platform
e. The latest Android system image for the emulator

Take your first step

a. Download ADT Bundle  for your OS from this link:
   http://developer.android.com/sdk/index.html


b. Once you've download the file, extract the content in an appropriate location (say C:\Android\ or ~/home/user/Android). You'll find two sub folders inside ADT Bundle folder (adt-bundle-linux-x86_64)- 'eclipse' and 'sdk'.


c. Updating SDK package: The ADT bundle you downloaded consists of minimalistic SDK features. You need to download additional emulator system images and tools for higher API levels (each Android release, for example- Gingerbread, Ice-cream Sandwich, Jellybean, etc is associated with an API level). Additional SDK tools are downloaded using a special utility called 'SDK Manager'. First of all, you need to set path for SDK tools in Eclipse: Go to Windows>Preferences>Android. Browse for the SDK folder inside ADT Bundle folder and click OK (Fig 1.5).
Fig 1.5 Setting up SDK path inside Eclipse
Now launch SDK manager: Go to Windows>Android SDK Manager. Select all and click 'Install packages' (Fig 1.6).
Fig 1.6 Updating SDK Tools




Tips n tricks:- If you're unable to download the packages, force https:// sources to be fetched using http:// and apply suitable proxy settings (if you're behind a firewall). In Android SDK Manager window, go to Tools>Options and do the necessary changes.

The next post will tell you how to set up an AVD emulator to test your application. You'll also find out how to run your application on a physical Android device.

No comments:

Post a Comment