Android-based project Structure Analysis

Source: Internet
Author: User
In "android basics using eclipse to build an android development environment and create the first Android Project", we used the Eclipse plug-in ADT to create our first Android project and used tools to develop the android project, we need to be familiar with the directory structure of the project and understand what is placed under each project. Expand the root directory structure of the entire project (the directory structure of SDK files of different versions varies, but is roughly the same), as shown in:

1. src directory

This directory is a common directory for saving Java source files, which is the same as the src directory in a common Java project.

2. gen directory

This directory is used to store all content automatically generated by the ADT plug-in. The most important file is the file named R. java. This Java file contains many static classes and corresponds to the files under the res directory to be introduced below. R. java files are in read-only mode and cannot be modified by yourself.

3. android2.3.3

This indicates the SDK version used by the project, that is, the "build SDK" We selected when creating the project ".

4. Assets Directory

This directory is used to store resource files, but the resource files it stores cannot automatically generate static attributes of static classes in the R. Java file of the gen directory. You can use the assetmanager class to access the resource files under this directory.

5. bin directory

This directory is automatically generated only after the android project is compiled. uncompiled projects do not contain this directory. The compiled bytecode is stored in this directory. The compilation process is first compiled into the classes. Dex file of the android Java Virtual Machine (Dalvik Virtual Machine), and then the classes. Dex file is packaged into an APK package.

6. libs directory

This directory is used to place some jar files required during development.

7. Res directory

This directory is also used to store resource files like the Assets Directory, but the biggest difference between it and the Assets Directory is that the resource files under the res directory will be in the R. A static attribute named after the resource file name is generated in the Java file.

This directory also contains a series of file directories. The drawable-hdpi, drawable-ldpi, and drawable-mdpi directories are used to store high, low, and medium resolution images respectively, the project created with SDK 1.5 has only one drawable folder. The new SDK generates multiple folders for storing images, android is mainly used to adapt image resources to different screen resolutions.ProgramThe corresponding image resources are automatically selected based on the resolution of the mobile phone;

The layout directory is used to store XML files of the interface layout;

The menu directory is an XML file used to store menu resources;

Values is an XML file that stores string, color, and size resources.

8. androidmanifest. xml file

This file is a project list file that lists the functions of the application and the system services you are using. In addition, we have developed various components (activity, service, contentprovider, broadcastreceiver) you also need to register here.

9. Project. properties File

this file is used to inform the development tool of the android API version used by the current project without any changes.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.