什么是真正的Android Studio Gradle版本? [英] What is real Android Studio Gradle Version?

查看:231
本文介绍了什么是真正的Android Studio Gradle版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题.

在(root)build.gradle Gradle版本中是3.1.3

In (Root)build.gradle Gradle Version is 3.1.3

(root)build.gradle

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

在项目结构中,Gradle版本为4.4

In project-structure Gradle Version is 4.4

项目结构

Gradle version 4.4

在Gradle-wrapper-properties发行版中,网址的Gradle版本为4.4

In Gradle-wrapper-properties distributionUrl's Gradle Version is 4.4

Gradle-Wrapper-Properties

#Tue Jul 17 17:49:20 KST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

但是我可以在SmartPhone中构建和运行应用程序.

But I can Build and I can Run Application in SmartPhone.

什么是真正的Gradle版本?

What is real Gradle Version?

请回复.

谢谢.

推荐答案

您需要在此处清除件事:

You need to be clear about THREE things here:

  • Gradle
  • Android Gradle插件
  • Gradle Wrapper

具体地说,

  • Gradle 是一个构建工具,可在Android上独立发展.从理论上讲,Gradle可用于构建任何类型的项目,例如,典型的Java项目,Android项目甚至iOS项目.它也可以与任何类型的IDE集成,例如Android Studio,Netbeans或Eclipse.在撰写本文时,最新的Gradle版本是4.9,您始终可以从 gradle安装指南. Gradle构建工具的主要功能之一是它支持自定义插件.
  • Android Gradle插件 Android Gradle插件是这样的gradle自定义插件之一.对于典型的Android项目,可以在顶级build.gradle中配置此插件的版本.

  • Gradle is a build tool which evolves itself independently on Android. Theoretically, Gradle can be used to build any kind of project, for example, typical Java project, Android Project and even iOS project. It can also be integrated with any kind of IDE, for example, Android Studio, Netbeans, or Eclipse. By the time of writing, the latest Gradle version is 4.9, and you can always check its current version from gradle installation guide. One of the great features of Gradle build tool is it supports Custom Plugins.
  • Android Gradle Plugin The Android Gradle Plugin is one of such gradle custom plugin. For the typical Android project, the version of this plugin can be configured in the top-level build.gradle.

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

对于此插件的每个版本,它都需要此页面中列出的最低Gradle版本 gradle-plugin 或查看下面的映射表以获取快速信息: 例如,Android Gradle插件版本 3.1.0 + 需要最低的gradle版本 4.4 ,可以通过Android Studio对其进行配置.

For each version of this plugin, it requires a minimum Gradle version as listed in this page gradle-plugin or see below mapping table for a quick information: For example, Android Gradle Plugin version 3.1.0+ requires a minimal gradle version 4.4 which can be configured via Android Studio.

Gradle Wrapper .根据官方文件 Gradle Wrapper

执行任何Gradle构建的推荐方法是在Gradle Wrapper(简称为"Wrapper")的帮助下. Wrapper是一个脚本,它调用已声明版本的Gradle,并在必要时事先下载它.因此,开发人员可以快速启动并运行Gradle项目,而无需遵循手动安装过程,从而节省了公司的时间和金钱.

The recommended way to execute any Gradle build is with the help of the Gradle Wrapper (in short just "Wrapper"). The Wrapper is a script that invokes a declared version of Gradle, downloading it beforehand if necessary. As a result, developers can get up and running with a Gradle project quickly without having to follow manual installation processes saving your company time and money.

可以在项目目录下的gradle-wrapper.properties中配置此包装器.例如

This wrapper can be configured from gradle-wrapper.properties under your project directory. For example,

distributionUrl = https://services.gradle.org/distributions/gradle-4.4-all.zip

distributionUrl=https://services.gradle.org/distributions/gradle-4.4-all.zip

或者从您所提问题的Android Studio GUI中获取 .

Or from the Android Studio GUI as said in your question .

这篇关于什么是真正的Android Studio Gradle版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆