Introduction to the simple features of Android Studio

Source: Internet
Author: User
Tags google guava

Android Studio
Build the System toolkit you use to build, test, run your applications and packages. The build system is independent of the Android studio, so you can call it from the Android studio or from the command line. After you write your application, you can use the features of the compile system:
Customize, configure, and expand the build process.

Create multiple applications that use different characteristics of the same project for your application.
Reuse code and resources.

the Androidstudio construction system is composed of Gradle. Gradle is an advanced build tool for managing dependencies, allowing you to define custom build logic.
Android Plugin tool does not depend on Android studio, although Android Studio is fully integrated by it.

The Gradle configuration includes the following aspects

Building variables

the build system can generate multiple apk for the same project based on different configurations. This is useful when you want to build different versions of the application without having to separate the project for everyone.

Dependent Relationships
Build systems to manage dependencies on projects and support them from local file systems and remote repositories. This prevents you from having to search, download and copy binary packages for your dependencies into your project directory.

List entry
The build system enables you to specify some elements of the value in the build configuration manifest file. These new values will overwrite the existing values in the manifest file. If you want to generate multiple
APK for your project, each of them has a different package name, Minimum SDK version, or target SDK version, which is useful.

Signature

The build system allows you to specify the build configuration signature settings, which can be used to sign your APK during the build process.

Proguard

The build system allows you to specify a different proguard for each version of the rule file. The build system can run the Proguard build process to confuse your class.

Test
Build a test source test in a system-generated project?? APK, so you don't have to create a separate test project. The build system can run tests during the build process.

Gradle build files using Groovy's syntax. Groovy is a dynamic language, you can use it to?? Define custom build logic and interact with Android plug-in Gradle, which provides Android-specific elements.

Established by convention

The Android Studio build system assumes a reasonable default value for the project structure and other compilation options.
If your project conforms to these conventions, your Gradle build file is simple. When some of these conventions do not apply to your project, you can configure almost every aspect of the build process.
For example, if your project's source is in a different directory than the default value, you can specify this location in the build file.

Projects and Modules
a project represents a complete Android application. The Android Studio project contains one or more module. A module is a standalone component of your application,
You can build, test or Debug. The module contains the source code and resources for your application. The Android Studio project consists of three modules:

Java Library Module
Contains code that can be reused. The build system generates a Java library module for a jar package.
Android Library Module

Contains reusable Android-specific code and resources. Build the system to generate the AAR (Android Archive) package Library module.

Android Application Module
Contains the application code and may depend on the library module, although many Android applications contain only one application module. Build the system build APK package for the application module.

Dependencies Dependency Relationship


Android Studio generates system-managed project dependencies and supports module dependencies, local binary dependencies, and remote binary dependencies.

Module Dependency relationship
a project module can include a list of other modules in the build file that it relies on. When you build this module, build the system assembly, including the required modules.

Local Dependencies
If you have a binary archive in your local file system that relies on a module, such as a jar file, you can declare these dependencies in the build file for that module.

remote Dependencies
When some of your dependencies are available in a remote repository, you do not have to download them and copy them to your project. The Android studio-built system supports remote MAVEN dependencies. Maven is a popular software project management tool that helps you use libraries to organize your project dependencies.


Many popular repositories and tools are available in public maven repositories. For these dependencies, you only need to specify your own MAVEN coordinates, which uniquely identifies each element in a remote repository. The format of the MAVEN coordinates used in the build system is the group: Name: Version. For example, MAVEN coordinates for Google Guava Library 16.0.1 version is Com.google.guava: Guava: 16.0.1.
In Maven's central repository, it is widely used to distribute many libraries and tools.


Build Tasks

The
Android Studio build system defines a series of layered build tasks:
Top-level task: The task used to produce the necessary results.
Build systems provide project tasks: Build the tasks of your applications and modules to create separate modules.

Gradle Wrapper
The Android Studio project contains Gradle wrapper consisting of the following:
A JAR File
A Properties File
A shell script for Windows platforms
A shell script for Mac and Linux platforms

Note: you should submit all of the above files to the resource control system.
Use Gradle wrapper (instead of a local gradle installation) to ensure that you always run a version of Gradle defined in the properties file. To configure your project to use a newer version of Gradle,
Edit the properties file and specify a new version.

Android Studio will read your profile from the Gradle wrapper directory and run the change wrapper, so you can work with multiple projects seamlessly based on different versions of Gradle
Android Studio does not support shell scripting, so you should define custom logic in the Gradle file instead.
ps:http://blog.csdn.net/xushuaic/article/details/26097663

Introduction to the simple features of Android Studio

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.