The (Android Virtual Device) AVD Manager downloaded with the SDK can be used to create virtual devices to test the android applications. First, run the AVD Manager icon in the Eclipse IDE. Now you can create an Emulator by giving the following attributes.
- Name : Device-1
- Target : Android 2.3.3(API Level 10)
- SD Card Size : 64 MiB
- Skin : Default(WVGA800)
- You can change the ram size, density and heap or add any new property in Hardware as you wish.
Run an application on the Emulator
Select the application and choose the “Run Configuration” from the menu item “Run”. Now you can select a virtual device which is compatible with the target SDK version, from the list of devices available. The devices you have created using the AVD Manager will be added to this list.
There are two types of API s available with Android for a particular version of platform. They are the Android API and the Google API. As an example the Android API level 15 includes Android 4.0.3 API and the Google APIs for the same platform 4.0.3. If you install only the SDK Platform of the Android 4.0.3(API 15) using the Android SDK Manager you can create a normal android application. But if you want to create a Map application you’ll have to install the Google APIs by Google Inc. The reason is that the normal Android API contains only the android.jar and in the Google APIs it provides the maps.jar in addition to the android.jar.
Hello World Android application
You can create a simple android application by following the steps below.
- Select File -> new project ->Android ->Android Project -> fill the project details in the new window.
- Project name : Hello Android
- Select Built target : Android 2.3.3 (API 10) – This will define the target SDK . This is usually the android SDK compiled against and used to indicate version the developer primarily tested and designed for.
- Application name: Hello World
- Package: example.app
- Create Activity : HelloAndroidActivity
- Min Version: 4 – This will define minimum platform version supported by the application.
First of all you have to download the Android SDK. The latest SDKs are available at the Android Developers website. The downloaded SDK contains only the core SDK tools, so you will have to use the SDK Manager executable file to download and install or update SDK components such as platforms, tools, add-ons, and documentation.
I have experiences with developing Android applications using Eclipse IDE. So the examples i discuss here uses Eclipse IDE. In order to develop android applications with Eclipse IDE the Android Development Tools (ADT) plugin should be installed in Eclipse IDE.
Download the SDK : http://developer.android.com/sdk/index.html
Install the ADT plugin
In Eclipse IDE there is a option called “Install New Software” under the “Help” menu item. There you can add the ADT plugin. There are two ways which you can add the ADT plugin to Eclipse IDE. The first one is to use the https://download.eclipse.org /releases/ url which download the ADT plugin and install it in IDE or the other is to download the ADT plugin in to a local location in your PC and give that location to the “Add Repository” dialog.
Download ADT plugin : http://developer.android.com/tools/sdk/eclipse-adt.html
Install SDK Platform
Now you can use the “Android SDK Manager” icon available with the Eclipse IDE to download the platforms and other tools. In order to create an application you have to install at least one version of SDK platform. Each API package contains a list of components and you can download all the components at once or the most necessary ones.
Set the location of the Android SDK in Eclipse
Before creating an application you have to set the location of the Android SDK in Eclipse IDE. Follow the steps below for that. Window ->Preferences -> Android -> browse the location of the SDK -> Apply -> list of SDK targets will display -> ok