Directory Structure – Android Project

When you create any android project using eclipse, a directory structure is followed.
At root the project name is present, and all the files and directories are listed under it. The description of the directories are:

  • src: It contains the packages and the java files under the packages.
  • gen: It is generated automatically. It contains the reference of the GUI components used in XML and other resources.
  • Android (version): It contains a jar file (android.jar) which have all the class available for current version.
  • Android Dependencies: It also contains a jar file, but dependencies only. Main contents are available in Android (version) directory.
  • assets: It contains the HTML files (if used) in the project.
  • bin: When the project is compiled and ready to be installed, then the files are transferred from the project and a copy of all assets and resources are stored in this directory. Here you can find the apk file which can be sent to any supporting android device and the application (if compiled correctly) can be installed.
  • libs: Contains private libraries, if any.
  • res: Acronym for resource directory. It contains many sub-directories.
    • drawable-hdpi: It contains images of High dpi, i.e. the size of image is 72×72 px.
    • drawable-ldpi: It contains images of low dpi, i.e. image size of 36×36 px.
    • drawable-mdpi: It contains images of medium dpi, i.e. image size of 48×48 px.
    • drawable-xhdpi: It contains images of extra high dpi, i.e. image size of 96×96 px.
      These drawable directories are used to store images only. And, the category is created, so that, a single application can support multiple screens. In a manner of saying, an application can run on mobile device of small screen or it can run on tables and television having large screen.
    • layout: It contains the XML files responsible for generating a GUI for activities.
    • menu: It contains XML files for menu options.
    • values: It contains XML files to hold values, which are globally available for applications. It may be string, array, or color.
    • anim: It contains XML files that represents animation objects.
    • xml: It contains XML files representing miscellaneous application component configuration.
  • AndroidManifest.xml: It contains information about the application. The information may include:
    • Package information,
    • Version Code and name,
    • Minimum SDK required for the application,
    • Target SDK version for the application,
    • Icon of project,
    • Information about Activities, services, content providers, and intent receivers,
    • Permission(s) it needs at user end,
    • List of libraries to which the application is linked.
  • This files helps in maintaining version control system. It stores the project settings as mentioned in AndroidManifest.xml.