Create a new project:
First, we would create a new project using eclipse. In different steps of project creation, we will configure the application which will affect some of our project configuration files.
Step 1: File->new->project->android application project
Here, we have namedour application, package name under which the application will run; build sdk version and minimum sdk version. Minimum sdk version is required to make your application backward compatible, i.e. to run into previous android OS based device.
Here, you have to name and title the activity, name the layout for this activity.
Let’s look at the basic structure after creating the project.
After creating new android project, the following folders are created in your project path.
src/: This directory contains the source code of the application. All the activities and java classes reside here. The folder structure is:
|-----> package name
|-----> source files
gen/: Contains the file generated by ADT. Two common files of this folder are:
BuildConfig.java : Contains build configuration information.
R.java: Contains a unique hexadecimal numbers for each of the UI element.
The folder structure is:
|-----> package name
|-----> generated files
Build SDK version: A folder named by build sdk version(in our example, named with Android 4.1) of the project contains the android jar folder. This folder consists of the default packages of this build SDK.
Android dependencies: Contains the JAR files on which the project depends.
assets/: generally it is empty. It is used for strong texture and game data.
bin/: This is build output directory. The apk file of the project is generated here.
libs/: Contains third-party library.
res/: It is the resource storage of the project. Application resources like Icon, images, layout, menu, strings are stored here. These resources reside in some specified folders which are as below:
drwable-hdpi: It contains high dpi images of the application.
drwable-ldpi: It contains low dpi images of the application.
drwable-mdpi: It contains medium dpi images of the application.
drwable-xhdpi: It contains extra high dpi images of the application.
layout: Android application UI are defined in XML format. This folder contains the layout files that are projected in the screen.
menu: It contains the xml files that define the application menus.
AndroidManifest.xml: This file is the heart of your application. It describes the configuration of the application. Some important information that the file describes are:
Package: The package name of the application.
Uses-sdk: Minimum sdk version to run the application and target sdk version.
Resources: Application’s icon, name, theme path.
Activity: List of activities and their configuration.
Let’s look at the manifest file of the application that we have created earlier.
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
proguard-project.txt: It optimizes the application code. It also makes your application harder to reverse engineering and thus enhances security of the application.
project.properties: It is generated automatically by android tools and target android version is written here.
Here, the project structure of a simple app has been discussed. This would help the developers to initiate their works on android.
Also get to know Guess Who? image apps are created in android Android Apps Development : Working with bitmap image and Create SqlLite Database and Table in Android which is helpful in creating app and games in android.