Saturday, August 18, 2012

Running Android virtual device - App Development Tutorial

Running Your App on Android virtual device

If you followed the previous tutorial Building your own Android App to create an Android project, you have created your first Hello World Android application source files that allow you to immediately run the app on the Android virtual device.

How you run your app depends on two things:

 Whether you have a real Android-powered device and whether you’re using Eclipse. This tutorial shows you how to install and run your app on a real device and on the Android emulator (Android virtual device), and in both cases with either Eclipse or the command line tools.
Before you run your app, note the various files that make up an Android project in the Package Explorer in Eclipse. 

Android project architecture 

android project architecture
android project architecture

The various folders and their files are as follows:

AndroidManifest.xml
The manifest file describes the fundamental characteristics of the app and defines each of its components.
For example all Activities and Services of the application must be declared in this file. It must also contain the required permissions for the application. For example if the application requires network access it must be specified.

src/
Directory for your app's main source files. By default, it includes an Activity class that runs when your app is launched using the app icon.

res/
Contains several sub-directories for app resources. res directory contains structured values which are known to the Android platform, the assets directory can be used to store any kind of data. You access this data via the AssetsManager which you can access the getAssets() method. AssetsManager allows to read an assets as InputStream with the open() method. 

drawable-hdpi/
Directory for drawable objects (such as bitmaps) that are designed for high-density (hdpi) screens. Other drawable directories contain assets designed for other screen densities.

layout/
Directory for files that define your app's user interface.

values/
Directory for other various XML files that contain a collection of resources, such as string and color definitions.
When you build and run the default Android app, the default Activity class starts and loads a layout file that says "Hello World." The result is nothing exciting, but it's important that you understand how to run your app before you start developing.

Run on the Android virtual device (Emulator)

You are now ready to test your application on the Android emulator. Right-click the project name in Eclipse and select Run As  ->  Android Application .

Run on the Android virtual device (Emulator)

Run on the Android virtual device (Emulator)

If you have not made any mistakes in the project, you should now be able to see the application installed and running on the Android virtual device (emulator).
Run on the Android virtual device (Emulator)


Run on a Real Android Device

If you have a real Android-powered device, here's how you can install and run your app . Visit this link from Google to know how to   Run on a Real Android Device
http://developer.android.com/training/basics/firstapp/running-app.html

Now you can explore some resources and book for increase your knowledge , you can begin with beginner book : Beginning Android 4 Application Development book reviews

No comments:

Post a Comment