Android project structure analysis

Project structure mode: Project

Insert picture description here

1. The .gradle and .idea
directories are all files automatically generated by AndroidStudio. We don't need to care about it or edit them manually.

2.
Almost all the code and resources in the app project are placed in this directory, and development work is basically carried out in this directory.

3. The build
directory does not need to be concerned too much, it mainly contains some files that are automatically generated during compilation.

4. The gradle
directory contains the gradle wrapper configuration file. Using the gradle wrapper method does not need to download the gradle in advance, but will automatically decide whether to download gradle online according to the local cache situation. Android Studio does not enable gradle wrapper by default. If you need to open it, you can click AndroidStudio navigation bar→File→Settings→Build, Execution, Deployment→Gradle to make configuration changes.

5. The .gitignore
file is used to exclude the specified directory or file from version control.

6. build.gradle
This is the project's global gradle build script, usually the content in this file does not need to be modified.

7. The gradle.properties
file is the global gradle configuration file. The properties configured here will affect all gradle compilation scripts in the project.

8.
The two files gradlew and gradlew.bat are used to execute gradle commands in the command line interface, where gradlew is used in Linux or Mac systems, and gradlew.bat is used in Windows systems.

9. The HelloWorld.imliml
file is a file automatically generated by all IntelliJ IDEA projects (Android Studio is developed based on IntelliJ IDEA) and is used to identify that this is an IntelliJ IDEA project.

10. The local.properties
file is used to specify the AndroidSDK path in the machine. Usually the content is automatically generated and does not need to be modified. Unless the location of AndroidSDK in this machine has changed, just change the path in this file to the new location.

11. The settings.gradle
file is used to specify all imported modules in the project. Since there is only one app module in the HelloWorld project, only the app module is introduced in this file. Under normal circumstances, the introduction of modules is done automatically.

Structure under the app directory

Insert picture description here

1. build
similar to this directory and the outer layer of the build directory, but also contains some major auto-generated file at compile time, but inside it's content will be more and more complicated and does not require too much care.

2. Libs
If third-party jar packages are used in the project, these jar packages need to be placed in the libs directory, and the jar packages placed in this directory will be automatically added to the build path.

3. androidTest
here is used to write AndroidTest test cases, which can perform some automated tests on the project.

4. java is
where all our Java code is placed.

5.
All pictures, layouts, strings and other resources used by res in the project must be stored in this directory. Of course, there are many subdirectories in this directory. Pictures are stored in the drawable directory, layouts are stored in the layout directory, and strings are stored in the values ​​directory.

6. AndroidManifest.xml
The configuration file of the Android project. All the four major components defined in the program need to be registered in this file. In addition, you can add permission declarations to the application in this file.

7. test
here is used to write UnitTest test cases, which is another way to automate the test of the project.

8. The .gitignore
file is used to exclude the specified directory or file in the app module from version control, and is similar to the outer .gitignore file.

9. App.imlIntelliJ IDEA
project automatically generated file, no need to care about or modify the content in this file.

10. build.gradle
This is the gradle build script of the app module. This file will specify many project build-related configurations.

11. The proguard-rules.pro
file is used to specify the obfuscation rules of the project code. When the code is developed, it will be marked as an installation package file. If you do not want the code to be cracked by others, the code will usually be obfuscated, making it difficult for crackers to read.

Guess you like

Origin blog.csdn.net/weixin_42403632/article/details/115270141