1.0, Android Studio manages your project

Project overview

The project in Android Studio contains everything needed to develop an app's working environment. From code, to resources, to testing to build configuration. When you create a new project, Android Studio creates the necessary structure for all files to make them visible in the Project on the left side of the IDE (click View> Tool Windows> Project).
Modules Modules
are a collection of build settings and source files, which can divide your project into several independently usable units. Your project can have one or more modules, and one module must have other modules as dependencies. Each module can be built, tested and debugged separately.
You can create a module file by clicking File>New>New Module.
Android Studio provides some different types of modules.

Android app module

Provides a container for your application source code, resource files, setting files and Android Manifest files. When you create a new project, the default module name is "app".
In the Create New Module window, Android Studio provides the following app modules:
1) Phone & Tablet Module
2) Android Wear Module
3) Android TV Module
4) Glass Module
They all provide corresponding code templates and necessary files.

Library module

  提供了一个可芙蓉代码的容器,你可以将模块用作其他模块的依赖或者导入其他项目。Library模块在结构上跟Android app 模块是一样的。但是在构建上,它会成成一个包而不是APK文件,所以不能独立安装到设备中。
   在Create New Module窗口,Android Studio提供了以下两种Library模块:

1) Android Library: This type of Library can contain any file types supported in Android projects. Including source code, resources and manifest files. The result of the build is to generate an AAR file, you can add the AAR file as a dependency to the Android app module.
2) Java Library: This type of Library only contains Java source files. The result of the build is to generate a Jar file. You can add the jar file as a dependency to the Android app module or other Java projects.
When you create a Library module and want to add to the current Android app module as a dependency, you can declared as follows:
Dependencies {
the compile Project ( ': My-Library-Module1')
}
project file
default, Android Studio in Show your project files in the Android view, so the project organization of the view does not directly map where the files actually exist. Instead, it is convenient to navigate among your key source files according to modules and file types, and hide files or folders that are not commonly used. The difference between the Android view display and the project structure saved in the disk is as follows:
1) All build.gradle is placed in the Gradle Script group.
2) Put all Manifest files into manifests.
3) Display related resource files into a group instead of different folders. For example, icons of different resolutions.
In the Android APP module, the files are grouped as follows:

Manifests
contains the AndroidManifest.xml file.
Java
contains Java source files classified according to package name, and contains unit test code.
Res
contains all non-code resources, such as XML layout, UI characters and image files, divided into several subfolders.
Write picture description here

Android project view

In order to view the real structure of the project (including hidden files) in the Android view, select Project view in the project window.
When you select the project view, you can see more files and directories. The most important ones are as follows:
module name/
Build/
contains build output
Libs/
contains private library
Src/
contains all code and resource files, the subfolders are as follows:
androidTest/
contains Instrumentation test
Main/
AndroidManifest.xml/
use To describe the application and each component
Java/
Include Java source code
Jni/
Include native code using Java Native Interface (JNI)
Gen/
Include Java files generated by Android Studio, such as R.java and interface files generated by AIDL files.
Res/
contains application resources, such as drawable files, layout files and UI characters.
Assets/
contains files that need to be packaged into the apk file.
Test/
contains local tests running on the JVM
Build.gradle(module)
defines the running configuration of the module
Build.gradel(project)
defines the build configuration that can be applied to all modules.
Write picture description here

Project structure settings

In order to change the various settings of your Android Studio project, open Project Structure by clicking File>Project Structure. It contains the following parts:
1) SDK Location: Set the location of the JDK, Android SDK and Android NDK used by the project.
2) Project: Set the Gradle plug-in version and central library.
3) Developer Services: include the settings of Google or third-party Android Studio additional components.
4) Modules: Allows you to edit the build settings, including the target and minimum SDK, concise app, and library dependencies.

Developer Service

The Developer Services of Project Structure contains several services that can be applied to your app. It includes the following:
1) AdMob: Allows you to turn on Google’s AdMob component for advertising.
2) Analytics: Allows you to open Google Analytics.
3) Authentication: allows you to open Google Sign-In
4) Cloud: allows you to open Firebase
5) Notifications: allows you to use Google Cloud Messaging

Module

The Modules setting allows you to change the settings of each project module. The setting page of each module is divided into the following sections:
1) Properties: Declare the version of the SDK and the build tool version of the module.
2) Signing: Signature
3) Flavors:
4) Build Types: Create or change the build configuration.
5) Dependencies: List all dependencies.

Author: Song Zhihui
personal micro-blog: Click to enter

Guess you like

Origin blog.csdn.net/song19891121/article/details/51719864