Android project structure for Android entry

     I created my first Android project using the Eclipse plug-in ADT, and used tools to develop Android projects. It is necessary for us to be familiar with the directory structure of the project and know what is placed under each project. Expand the entire project, and its root directory structure (different versions of the SDK file directory structure will be somewhat different, but roughly the same) as shown below:




      1. src directory

          This directory is a common directory for storing java source files, which is the same as the src directory in common java projects.

      2. gen directory

          This directory is used to store all JAVA codes automatically generated by the ADT plug-in. The most important one is the file named R.java. This java file contains many static classes and corresponds to the files in the res directory described below. The R.java file is in read-only mode and cannot be changed by yourself.

      3. Android4.4.2

          This indicates the SDK version used by the project, that is, the "Build SDK" we selected when creating the project. (The version used in this project is 4.4.2)

      4. Android dependencies        

         The directory appears in ADT16 future releases, ADT is a new third-party library reference, when we need to refer to third-party libraries, just to the library to copy the libs folder, ADT will automatically complete the library Reference (as in this example android-support-v4.jar)

      5. The assets directory

          This directory is used to store resource files, but the stored resource files cannot automatically generate static attributes of static classes in the R.java file in the gen directory. The resource files in this directory can be accessed through the AssetManager class.

      6. The bin directory

          This directory will be automatically generated only after the Android project is compiled. Uncompiled projects do not include this directory. The compiled bytecode is stored in this directory. The compilation process is that ADT first compiles the project into the Android Java virtual machine (Dalvik Virtual Machine) file classes.dex, and then packages the classes.dex file into an apk package. (apk is the installation package generated by the android platform)

      7. libs directory

          This directory is used to place some jar files needed in the development process (this directory will be generated by default, if not, you can create it manually).

      8. res directory

          This directory, like the assets directory, is also used to store resource files. When resources are added to the directory, R.java will automatically record them. The biggest difference between it and the assets directory is that the resource files in the res directory will generate static attributes named after the resource file name in the R.java file in the gen directory.



          This directory also contains a series of file directories, among which the drawable-hdpi, drawable-ldpi, and drawable-mdpi directories are used to store high, low, and medium resolution pictures respectively. There is only one drawable under the project created with SDK 1.5 Folder, the reason why there are multiple folders for storing pictures under the new version of the SDK is mainly because Android considers that in order to adapt the picture resources to the resolution of various screens, the application will automatically select the corresponding picture according to the phone resolution Resources;

          The layout directory is used to store the xml file of the interface layout . The default layout file in the layout directory is activity_main.xml. You can place different layout structures and controls in this file to meet the needs of the project interface, or you can create a new layout file.

          The menu directory is used to store the xml files of the application menu resources;

          values ​​is used to store xml files of string resources, color resources, and size resources.


      9. AndroidManifest.xml文件

          项目的总配置文件,记录应用中所使用的各种组件。里面列出了应用所具有的功能和你所使用的系统服务,在这个文件中,你可以指定应用程序使用到的服务(如电话服务、互联网 服务、短信服务、GPS服务等等)。另外当你新添加一个Activity的时候,也需要在这个文件中进行相应配置,只有配置好后,才能调用此 Activity。我们开发好的各种组件(Activity、Service、ContentProvider、BroadcastReceiver)都要在此注册。

      10.  project.properties文件

          该文件我们无需关心,它用于告诉开发工具目前的项目使用的Android API版本,无需改动。


Guess you like

Origin blog.csdn.net/liushulin183/article/details/49933377