For Android Application Development we generally use Eclipse IDE. When You create a new Android project in Eclipse It create a Project Directory with some predefined folders and files. In that project Directory mostly time we use src,res, assets folder and its sub folder and files for development. But we did not pay more attention on some of file which we did not use generally during project development. As for example progurd-project .txt and project.propertise.
Here I am going to explain Android Project directory with all folders and files. At First Look on this Image of Project directory
Now I am going to explain each folder one by one .
1. src/
Contains your stub Activity file, which is stored at src/your/package/namespace/ActivityName.java. All other source code files (such as .java or .aidl files) go here as well.
2. 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
3. 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. You can navigate this directory in the same way as a typical file system using URIs and read files as a stream of bytes using the AssetManager. For example, this is a good location for textures and game data.
4. bin/
Bin folder is the area used by the compiler to prepare the files to be finally packaged to the application’s APK file. This includes
5. libs/
External library files will be placed in this folder. If you want to any external library in your project place the library jar inside this folder and it will be added to the classpath automatically.
6. 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. This is the following sub-folder of this res folder.
Drawable
folders are resource directories in an application that provides different bitmap files (PNG, JPEG, or GIF), 9-Patch image files drawables for medium, high, and extra high density screens.
/res/drawable-mdpi - bitmap for medium density
/res/drawable-hdpi - bitmap for high density
/res/drawable-xhdpi - bitmap for extra high density
/res/drawable-nodpi - bitmap with no pre-scaling
layout
XML files that are compiled into screen layouts (or part of a screen). A layout resource defines the architecture for the UI in an Activity or a component of a UI. These are resource directories in an application that provides different layout designs for different screen sizes
/res/layout - layout for normal screen size or default
/res/layout-small - layout for small screen size
/res/layout-large - layout for large screen size
/res/layout-xlarge -layout for extra-large screen size
/res/layout-xlarge-land - layout for extra-large in landscape orientation
/res/layout-sw600dp - layout for tablets or layout for 7” tablets (600dp wide and bigger)
/res/layout-sw720dp - layout for 10” tablets (720dp wide and bigger)
/res/layout-w600dp - layout for Multi-pane (any screen with 600dp available width or more)
menu
This folder contains menu resources to be used in the application (Options Menu, Context Menu, or submenu)
Values
It is Used to define strings, colors, dimensions, styles and static arrays of strings or integers. By convention each type is stored in a separate file, e.g. strings are defined in the res/values/strings.xml file.
Here you can change the String variables in different language to chage your entire application for that Language So it is advisable to define all your string variable here.
/res/values-v11 is the values of the API version 11, and
/res/values-v14 is the values of the API version 14
anim
This folder contains animations in XML for the property animation API which allows to animate arbitrary properties of objects over time.
color
Here I am going to explain Android Project directory with all folders and files. At First Look on this Image of Project directory
Now I am going to explain each folder one by one .
1. src/
Contains your stub Activity file, which is stored at src/your/package/namespace/ActivityName.java. All other source code files (such as .java or .aidl files) go here as well.
2. 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
3. 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. You can navigate this directory in the same way as a typical file system using URIs and read files as a stream of bytes using the AssetManager. For example, this is a good location for textures and game data.
4. bin/
Bin folder is the area used by the compiler to prepare the files to be finally packaged to the application’s APK file. This includes
- Compiling your Java code into class files
- Putting your resources (including images) into a structure to be zipped into the APK
5. libs/
External library files will be placed in this folder. If you want to any external library in your project place the library jar inside this folder and it will be added to the classpath automatically.
6. 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. This is the following sub-folder of this res folder.
- drawable/
- layout/
- menu/
- values/
- anim/
- color/
- raw/
- xml/
Drawable
folders are resource directories in an application that provides different bitmap files (PNG, JPEG, or GIF), 9-Patch image files drawables for medium, high, and extra high density screens.
/res/drawable-mdpi - bitmap for medium density
/res/drawable-hdpi - bitmap for high density
/res/drawable-xhdpi - bitmap for extra high density
/res/drawable-nodpi - bitmap with no pre-scaling
layout
XML files that are compiled into screen layouts (or part of a screen). A layout resource defines the architecture for the UI in an Activity or a component of a UI. These are resource directories in an application that provides different layout designs for different screen sizes
/res/layout - layout for normal screen size or default
/res/layout-small - layout for small screen size
/res/layout-large - layout for large screen size
/res/layout-xlarge -layout for extra-large screen size
/res/layout-xlarge-land - layout for extra-large in landscape orientation
/res/layout-sw600dp - layout for tablets or layout for 7” tablets (600dp wide and bigger)
/res/layout-sw720dp - layout for 10” tablets (720dp wide and bigger)
/res/layout-w600dp - layout for Multi-pane (any screen with 600dp available width or more)
menu
This folder contains menu resources to be used in the application (Options Menu, Context Menu, or submenu)
Values
It is Used to define strings, colors, dimensions, styles and static arrays of strings or integers. By convention each type is stored in a separate file, e.g. strings are defined in the res/values/strings.xml file.
Here you can change the String variables in different language to chage your entire application for that Language So it is advisable to define all your string variable here.
/res/values-v11 is the values of the API version 11, and
/res/values-v14 is the values of the API version 14
anim
This folder contains animations in XML for the property animation API which allows to animate arbitrary properties of objects over time.
color
For XML files that describe colors
raw
For arbitrary raw asset files. Saving asset files here instead of in the assets/ directory only differs in the way that you access them. These files are processed by aapt and must be referenced from the application using a resource identifier in the R class. For example, this is a good place for media, such as MP3 or Ogg files.
xml
For miscellaneous XML files that configure application components. For example, an XML file that defines a PreferenceScreen, AppWidgetProviderInfo, or Searchability Metadata. See Application Resources for more information about configuring these application components.
7. AndroidManifest.xml
All the android applications will have an Android Manifest.xml file in the root directory. This file will contain essential information about the application to the Android system, information the system must have before it can run any of the application's code. This control file describes the nature of the application and each of its components. In this manifest file you can define your activity, services, premission and SDK version etc.
8. ic_launcher-web.png
This is an icon to be used in Google play. Applications on Google Play require a high fidelity version of the application icon. It is not used in your actual app or the launcher, so it is not packaged in the APK.. The specifications for the high-resolution icon are:
32-bit PNG with an alpha channel
512 x 512 pixels
Maximum size of 1024KB
9. 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.
The ProGuard tool shrinks, optimizes, and obfuscates your code by removing unused code and renaming classes, fields, and methods with semantically obscure names. The result is a smaller sized .apk file that is more difficult to reverse engineer.
10. 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.
That is all about Android eclipse project directory structure......
In next Post I will describe in depth for two file proguard-project.txt and project.properties . this is the less use file by many developer but it is extremely useful to secure and customize your APk file.
Thanks Happy Coding !!!