Android Studio gradle Build Script

Source: Internet
Author: User

Gradle is a dependency management tool, based on the groovy language, which is oriented toward Java applications, which discards the cumbersome configuration of XML-based, and replaces it with a groovy-based internal domain-specific (DSL) language.

The build tool is a collection of functions such as compiling, running, signing, packing, relying, managing, etc. of your project, and the traditional building tools are Make,ant,maven,lvy and so on.

And Gradle is a new generation of automated building tools, which is a standalone project, unrelated to As,android.

There is a build.gradle file in the root directory of the project, which has a code like this:

Classpath ' com.android.tools.build:gradle:2.1.3 '

This is the code that relies on the Gradle plug-in, the following version number represents the version of Android Gradle plugin, not gradle version, as equipped with Android Gradle plugin this plugin,

We can use the Gradle build tool in as.


1.Project Build.gradle This file describes which module (s) are included in project

2.Project Build.gradle This file describes the repositories referenced by the Gradle build and the most basic dependencies

3.Module Build.gradle This file describes some of the configuration of the main module


Build.gradle (Module:app)//This build.gradle describes primarily the configuration of the main moudle

dependencies {
Dependent libraries for modules
Compile Filetree (include: [' *.jar '], dir: ' Libs ')
Local dependent libraries
Testcompile ' junit:junit:4.12 '
Compile ' com.android.support:appcompat-v7:24.1.1 '
Remote dependent Library, formatted as Group:name:version
Compile ' com.android.support:cardview-v7:24.1.1 '
Compile ' com.android.support:design:24.1.1 '
}

4.Gradle Wrapper
Gradle wrapper literally understood as Gradle's wrapper, Android Studio uses Gradle wrapper to fully embed the Gradle Android plugin.

Reference: http://www.jcodecraeer.com/a/anzhuokaifa/Android_Studio/2016/0216/3969.html

Android Studio gradle Build Script

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.