With the previous learning, the Android Studio development environment is ready for OK, and the native emulator and genymotion emulator running the Android app are ready. Before simply talking about the project structure and operating principles of the Android project in Eclipse, let's take a look at the project structure of Android Studio in this issue.
First, the Project view mode
Earlier in the familiar Android studio interface mentioned in the Project Project tool window, a total of 10 viewing modes are supported:
1. Project mode:
Displays all file information, the location of the file is the actual physical structure, so it is recommended to switch to project mode when viewing the file.
2. Package Mode:
Only the code and resources for the project itself are displayed, and the rest of the information is hidden, and the code and resources are displayed in a hierarchical file.
3. Scratches mode:
Scratches mode displays only draft files. Scratch files (draft files) is a very handy feature that can help us quickly experiment and build prototypes, using Scratch files to quickly sketch sketches without repairing forth projects and creating any files, Android Studio (Intellij IDEA) provides all the auxiliary coding capabilities for scratch files.
4. Android Mode:
All files are categorized by type, which is not the actual file structure in the computer.
5. Project Files Mode:
A project structure similar to eclipse.
6. Problems mode:
Displays only the file structure of the error.
7. Production Mode:
Displays only the production file structure.
8. Tests mode:
Only the test file structure is displayed.
9. Local Unit Tests:
Displays only the local unit test file structure.
10. Android instrumented Tests:
Only the device unit test file structure is displayed.
Depending on the view, you can see that each viewing mode uses a different purpose and selectively switches in the actual opening according to your own needs. The most common use is Project mode, Android mode, and sometimes the package mode is used.
Our main learning today is the physical structure of the project model, and the computer file system to see the same level of file, very clear.
Second, the project directory structure analysis
01. Project Directory
So let's take a look at the role of each directory and file, first of all to see the main directory structure, which varies greatly compared to the Eclipse directory structure.
In Android studio, project can be understood as a complete app project, consisting of the application module and some dependent module, equivalent to the workspace in Eclipse.
1,. gradle
Gradle compiled system, version specified by wrapper.
2. Idea
Automatically generated directories for Android studio profiles, including copyrights, check configurations, jar package information, project names, compilations, encodings, Gradle, modules, and more.
3. App
The module--module in the project is a application or public library that can be run and debugged separately. The module in Android Studio is equivalent to project in Eclipse, and you can have multiple module in one project.
4. Build
The project compilation directory.
5, Gradle
Gradle build directory.
6,. Gitignore
Git in the project ignores the configuration file.
7, Build.gradle
The Gradle build configuration file for the project.
8, Gradle.properties
Gradle The associated global property profile.
9, Gradlew
The Gradlew configuration file.
10, Gradlew.bat
The Gradlew configuration file on Windows.
11, HELLOWORLD.IML
The project configuration file.
12, Local.properties
Local property profile (key setting, ANDROIDSDK location, and so on)
13, Setting.gradle
Global configuration file.
14, External Libraries
The list of dependent inventory used in the project includes the Android SDK version and storage path, JDK version and storage path, and various other dependent libraries.
02. Module Directory
The previous overview of the Android Studio project's home directory, the next look at the app directory, which is the module directory.
1. Build
The file storage directory after the module is compiled.
2, Libs
The module is dependent on the jar package to store the directory.
3, Src/androidtest
The device test code is stored in the directory.
4, Src/main/java
The code stores the directory, which is equivalent to the SRC directory inside eclipse.
5, Src/main/res
The resource file directory, which is equivalent to the Res directory inside Eclipse, is described in detail later.
6, Src/main/androidmanifest.xml
An application's basic information list, equivalent to the Androidmanifest.xml file in Eclipse.
7, Src/test
Test the code to store the directory.
8,. Gitignore
Git version management in the module ignores files and marks which files do not go into the git repository.
9, APP.IML
Module configuration file.
10, Build.gradle
The Gradle build configuration file for the module.
11, Proguard-rules.pro
The code confuses the file.
In addition to the files and folders described above, you may encounter these later in the development process:
11, Src/main/jnilibs
So files are stored in the directory.
12, Src/main/assets
Additional resource files are stored in a directory that works with the assets directory in Eclipse.
03. Res Directory
Res directory is the same as the Res directory in Eclipse, because this directory and Java directory is the focus of Android development, here to separate out to understand, about the specific content of the follow-up and gradually learn.
1, drawable
Holds a bitmap file that can be converted to a drawing resource or an XML file that defines a drawing resource.
2. Layout
Stores an XML file that defines the layout of the user interface.
3, mipmap-hdpi
High-resolution icon directory.
4, mipmap-mdpi
Medium-resolution icons directory, generally less used, in addition to compatible with old mobile phones.
5, mipmap-xhdpi
Ultra-high resolution catalogs.
6, mipmap-xxhdpi
Ultra-High resolution directory, the current mainstream phone resolution.
7, mipmap-xxxhdpi
Ultra-ultra-high-resolution catalogs, such as flat-screen TVs.
8. Values
Contains XML files that define multiple types of resources, mainly including the following:
Demens.xml: Defining Dimension Resources
String.xml: Defining String Resources
Styles.xml: Defining Style resources
Colors.xml: Defining Color Resources
Arrays.xml: Defining Array Resources
Attrs.xml: Custom control's properties are used more when customizing the control.
In addition to these, the following directories may be involved:
9. Menu
Stores an XML file that defines a menu resource.
10. Raw
Store a variety of native resources (audio, video, some XML files, etc.).
11, Anim
The XML file that holds the tweened animation.
About the project structure of Android Studio first here, some of the specific files involved in the subsequent contact to learn, on the Android application of the starting principle can refer to the previous Eclipse content HelloWorld, my first trip starting point.
Are you ready to start learning about Android interface design from the next issue? Hurry up and get ready to go.
Come here today, if you have any questions welcome message to discuss together, also welcome to join the Android 0 Basic introductory Technical discussion group, grow together!
Past period Summary share:
Android 0 Basics Introduction 1th: Android's past life
Android 0 Basics Section 2nd: Android system Architecture and application components those things
Android 0 Basics Section 3rd: Bring you up to talk about Android development environment
Android 0 Basics 4th: Installing and configuring the JDK correctly Ko fu the first trick
Android 0 Basics 5th: Use ADT bundles to easily meet the goddess
Android 0 Basics 6th: Configuration Optimization SDK Manager, official dating goddess
Android 0 Basics 7th: Take care of Android simulator and start the Sweet journey
Android 0 Basics 8th: HelloWorld, the starting point for my first trip
Android 0 Basics 9th: Android app, no code can be developed
Android 0 Basics Section 10th: Development IDE Big upgrade, finally ushered in Android Studio
Android 0 Basics Introductory Section 11th: Simple steps to take you to fly, run Android Studio project
Android 0 Basics 12th: Get familiar with the Android studio interface and start selling
Android 0 Basics 13th: Android Studio Configuration optimization to create a development tool
Android 0 Basics 14th: Using high-speed genymotion, stepping into the rocket era
This article copyright for the public Share talent show (Shareexpert)--Xin 鱻 all, if reproduced please note source, hereby declare!
Android 0 Basics Section 15th: Mastering the Android Studio project structure, sailing