Directory Structure in Android

The Directory Structure of an Android Project:

Android does its best to externalize all application assets that do not absolutely need to be in your
Java code. It does this by using the simpler XML markup language to define UI (user interface)
designs and data structures that would otherwise need to be explicitly declared and coded in Java.

This modularization is aided and implemented by having a clearly defined project hierarchy folder
structure, which holds logical types of application assets together in an orderly fashion.

Once you have created the project by,
File-> New - >Android Application project.

You get the following directory structure,


src:  User specified java source code files will be available here.

gen : The gen directory in an Android project contains auto generated files. You can see R.java inside this folder which is a generated class which contains references to certain resources of the project. R.java is automatically created by the Eclipse IDE and any manual changes are not necessary.

assets : This is empty. You can use it to store raw asset files. Files that you save here are compiled into an .apk file as-is, and the original filename is preserved

res: Android supports resources like images and certain XML configuration files, these can be keep separate from the source code. All these resources should be placed inside the res folder. This res folder will be having sub-folders to keep the resources based on its type.

anim: For XML files that are compiled into animation objects. See the Animation resource type.

layout: UI screen layouts go in the /res/layout folder, which holds XML files containing UI layout definitions written in XML.

drawable-hdpi: high-resolution images in PNG or the JPEG format go into the /res/
drawable-hdpi (high resolution screen-drawable image) folder.

drawable-ldpi: low-resolution images in PNG or the JPEG format go into the /res/drawable-ldpi
(low resolution screen- drawable image) folder.

drawable-mdpi: medium-resolution images in PNG format or the JPEG format go into the
/res/drawable-mdpi (medium resolution screen-drawable images) folder.

drawable-xhdpi: extra-high-resolution images in PNG format or the JPEG format go into the
/res/drawable-xhdpi (high resolution screen-drawable images) folder.

values: XML files that define constant values are in the res/values folder.

values-v11: honeycomb theme XML files that define new UI theme values are in the res/values-v11 (referencing API Level 11 through 13) folder.

values-v14: Ice Cream Sandwich theme XML files that define new UI theme values are in the res/values-v14 (referencing API Level 14 through 16) folder.

libs: Contains private libraries.

menu: XML files defining menu layouts are in the res/menu folder.

In the values folder we have :

colors.xml: An XML file that will define the color values to be used in the app.These allow you to standardize the UI. For example, you would define your background color. Then, if you decide to tweak it later, you need to do the tweaking in only one place.

dimens.xml: An XML file that defines dimension values, such as standard heights and font sizes for your UI.

arrays.xml: An XML file that defines a series of values to be used together (known as an array).

strings.xml: An XML file that defines text strings to be used in the application.For example, you can place any screen titles or the app’s name here and reference them in your code.

styles.xml: An XML file that defines styles to be used in the application. These styles are then applied to the UI elements that require them, so you separate the look of your app from the layout and functionality.

AndroidManifest.xml : The control file that describes the nature of the application and each of its components. For instance, it describes: certain qualities about the activities, services, intent receivers, and content providers; what permissions are requested; what external libraries are needed; what device features are required, what API Levels are supported or required; and others.

ic_launcher-web.png : This is an icon to be used in Google play.

proguard-project.txt: Everything in the proguard-project.txt file will be in commented out state, because in general most people don't have any project specific needs, just to run ProGuard tool with standard settings.

project.properties: project.properties is the main project’s properties file containing information such as the build platform target and the library dependencies has been renamed from default.properties in older SDK versions. This file is integral to the project.




Reach us At: - 0120-4029000 / 24 / 25 / 27 / 29 Mbl: 9953584548
Write us at: - smruti@apextgi.com and pratap@apextgi.com

1 comment: