Android Studio Gradle Configuration

Source: Internet
Author: User

Just transferred from Eclipse to Androd studio encountered a lot of pits, today to help everyone to fill pits

As of May 16, 2013, at the I/O Conference, Google launched the new Android development environment,--android Studio, and made improvements to the developer console, adding five new features, and Google has completely abandoned eclipse turn as!

We know that as has chosen the best build tool Gradle

Gradle:gradle is a project automation building tool based on the Apache Ant and Apache maven concepts. It uses a particular domain-specific language (DSL) based on groovy to declare the project settings, discarding the tedious configuration of XML-based.

Java-oriented applications. Currently its supported languages are limited to Java, groovy, and Scala, and plans will support more languages in the future. The future is wide.The following entry into the theme in as is mainly configured Gradle and Android Gradle plug-ins, note that Gradle and (Android Gradle plugin) must not be confused, 2 of them are different. Configuration of 1.gradleWhen we set gradle under Gradle under Setting and select "Use Defalut Gradle wrapper (recommended)", the as will be based on {Project.dir}\gradle\wrapper\ The configuration in the Gradle-wrapper.properties file goes gradle when we build an Android project with AS, we configure the Gradle,gradle package, which must be in {Project.dir}\gradle\wrapper\ Gradle-wrapper.properties files, such as My Computer: C:\Users\dsfg\.gradle\wrapper\dists\gradle-2.4-all
#Wed APR 15:27:10 PDT 2013distributionbase=gradle_user_homedistributionpath=wrapper/distszipstorebase=gradle_ User_homezipstorepath=wrapper/distsdistributionurl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip

This configuration is gradle if the directory "user home directory/.gradle/wrapper/dists/..." If there is, as will not go to https\://services.gradle.org/distributions/ Gradle-2.2.1-all.zip to download, as will take advantage of the cache in this directory, if the directory does not exist Gradle, as will go to the site according to gradle version to download to the user home directory/.gradle/wrapper/dists/ Gradle-2.2.1-all "directory.

If the "Use local Gradle distribution" is selected, the native Gradle is used, and the local gradle is under the Gradle directory under the main directory of as, such as My Computer D:\android development environment \ android-studio-ide-143.2739321-windows\android-studio\gradle\gradle-2.10

"Global Gradle Setting" We don't think about it for the time being

2.android Gradle plug-in configuration

The above I discuss is gradle configuration, below we say the Android Gradle plug-in configuration, we through the main project Build.gradle to set up the Android Gradle plugin

In the Build.gradle

dependencies {    classpath ' com.android.tools.build:gradle:2.0.0 '}

 The version of the Android Gradle plugin that is configured here is 2.0.0, again emphasizing that we must remember that the Gradle version and the version of the Android Gradle plugin are not the same thing at all and cannot be confused,

Below is the version relationship table for Android studio version, Gradle version, Android Gralde plugin

The official documentation is attached below:http://tools.android.com/tech-docs/new-build-system/version-compatibility

Android Studio Gradle Configuration

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.