The basic use of Android Studio is explained in the front. When it comes to Android studio, Gradle is a natural concern. Next, let's analyze the mystery gradle together.
1. The presence of the build tool:
Gradle and MAVEN are project auto-building tools, compiling source code is just one aspect of the process, and more importantly, you want to publish your software in a production environment to generate business value, so you run tests, build distributions, analyze code quality, and even provide different versions for different target environments , and then deploy. It is necessary to automate the whole process. So the building tools came into being.
Gradle: A dependency management tool that, based on the groovy language, discards the tedious configuration of maven and Ant-based XML, instead of the internal domain-specific (DSL) language of groovy.
2. Specific analysis
Figure 1
( 1) Hswallpager/app/build.gradle (that is, 2 of the logo)-module configuration checklist, a very important configuration checklist for the project:
Most of the labels have been labeled above and are not covered here.
description of the points: 1. Apply plugin: Each module needs to have a Gradle configuration file, the syntax is the same, the only difference is that the beginning of the declaration is
Apply plugin: ' Com.android.library '
2.buildtoolsversion This requires you to install the version locally, many people import new third-party libraries, one of the reasons for the failure is that the build version is incorrect,
This can be manually changed to your local version or open the SDK Manager to download the corresponding version.
(2) Global build.gradle (that is, figure 1 identifies 3 files)
Description: The content mainly contains two aspects: one is the source of the declaration warehouse, here can see is the specified Jcenter (), the previous version is Mavencentral (), Jcenter can be understood as a new central remote warehouse, compatible with MAVEN Central warehouse, and better performance. Another is the version that declares Android Gradle plugin, the Android Studio 1.0 Official edition must require support for Gradle Plugin 1.0 version.
mavencentral (), which indicates that dependencies are obtained from the central Maven 2 warehouse.
Jcenter (), indicating that the dependency was obtained from the Bintary's jcenter Maven repository.
The above is a basic description of the Gradle file, further refer to the next section of the gradle explanation. There may be other configurations in the work, specific time in the detailed discussion, the above configuration is commonly used, focus on mastering.
Android Studio Gradle Configuration graphic explanation