如何在Android Studio中更新Gradle?

本文介绍了如何在Android Studio中更新Gradle。包括使用默认Gradle包装器和手动选择所需Gradle版本的步骤。同时提供了官方链接,帮助用户了解版本兼容性和Gradle包装器信息。
摘要由CSDN通过智能技术生成

本文翻译自:How to update gradle in android studio?

I installed Android Studio 0.1.9. 我安装了Android Studio 0.1.9。 Today I got and update to version 0.2 and of course I updated. 今天我得到并更新到0.2版,当然我也更新了。 After the installation I restarted Android Studio but now I get this message: 安装后,我重新启动了Android Studio,但现在我收到以下消息:

Project is using an old version of the Android Gradle plug-in. 项目正在使用旧版本的Android Gradle插件。 The minimum supported version is 0.5.0. 支持的最低版本是0.5.0。 Please update the version of the dependency 'com.android.tools.build:gradle' 请更新依赖项'com.android.tools.build:gradle'的版本

How do I do that? 我怎么做? I can't find any update tools for the gradle plugin in android studio. 我在android studio中找不到gradle插件的任何更新工具。


#1楼

参考:https://stackoom.com/question/1CNll/如何在Android-Studio中更新Gradle


#2楼

This may not be the exact answer for the OP, but is the answer to the Title of the question: How to Update Gradle in Android Studio (AS): 这可能不是OP的确切答案,而是问题标题:如何在Android Studio(AS)中更新Gradle的答案:

  • Get latest version supported by AS: http://www.gradle.org/downloads (Currently 1.9, 1.10 is NOT supported by AS yet) 获取AS支持的最新版本: http//www.gradle.org/downloads (当前1.9、1.10尚不支持AS)
  • Install: Unzip to anywhere like near where AS is installed: C:\\Users[username]\\gradle-1.9\\ 安装:解压缩到安装AS的位置附近的任何位置:C:\\ Users [用户名] \\ gradle-1.9 \\
  • Open AS: File->Settings->Gradle->Service directory path: (Change to folder you set above) ->Click ok. 打开AS:“文件”->“设置”->“等级”->“服务目录路径” :(更改为上面设置的文件夹)->单击“确定”。 Status on bottom should indicate it's busy & error should be fixed. 底部的状态应表明它很忙,并且错误应该得到解决。 Might have to restart AS 可能必须重新启动AS

#3楼

I can't comment yet. 我还不能发表评论

Same as Kevin but with different UI step: 与Kevin相同,但UI步骤不同:

This may not be the exact answer for the OP, but is the answer to the Title of the question: How to Update Gradle in Android Studio (AS): 这可能不是OP的确切答案,而是问题标题:如何在Android Studio(AS)中更新Gradle的答案:

  • Get latest version supported by AS: http://www.gradle.org/downloads (Currently 1.9, 1.10 is NOT supported by AS yet) 获取AS支持的最新版本: http//www.gradle.org/downloads (当前1.9、1.10尚不支持AS)
  • Install: Unzip to anywhere like near where AS is installed: C:\\Users[username]\\gradle-1.9\\ 安装:解压缩到安装AS的位置附近的任何位置:C:\\ Users [用户名] \\ gradle-1.9 \\
  • Open AS: File->Settings->Build, Execution, Deployment->Build Tools-> Gradle->Service directory path: (Change to folder you set above) ->Click ok. 打开AS:“文件”->“设置”->“构建,执行,部署”->“构建工具”->“ Gradle”->“服务目录路径” :(更改为上面设置的文件夹)->单击“确定”。 Status on bottom should indicate it's busy & error should be fixed. 底部的状态应表明它很忙,并且错误应该得到解决。 Might have to restart AS 可能必须重新启动AS

#4楼

Step 1 (Use default gradle wrapper) 步骤1(使用默认的Gradle包装器)

File→Settings→Build, Execution, Deployment→Build Tools→Gradle→Use default Gradle wrapper (recommended) 文件→设置→构建,执行,部署→构建工具→Gradle→使用默认的Gradle包装器(推荐)

在此处输入图片说明

Step 2 (Select desired gradle version) 步骤2(选择所需的Gradle版本)

File→Project Structure→Project 文件→项目结构→项目

Gradle版本屏幕截图

The following table shows which version of Gradle is compatible with specific version of Android plugin for Gradle : 下表显示了哪个版本的Gradle与特定于Android的Gradle插件版本兼容: 相容性表

Latest stable versions you can use with Android Studio 3.5.1 (October 2019): 您可以在Android Studio 3.5.1中使用的最新稳定版本(2019年10月):

Android Plugin version: 3.5.1
Gradle version: 5.4.1

Official links 官方链接


#5楼

It works for me: 这个对我有用:

just go to '/home/your-user/.gradle/wrapper/dists/' 只需转到'/ home /您的用户/.gradle/wrapper/dists/'

delete everything inside of this 删除其中的所有内容

It will be replaced by android studio 它将被android studio取代

on terminal run: ionic emulate android 在终端运行:离子模拟android

Its all... 全部...


#6楼

Go to File > Settings > Builds,Execution,Deployment > Build Tools > Gradle >Gradle home path 转到文件>设置>构建,执行,部署>构建工具> Gradle> Gradle主路径

Now, set Use default gradle wrapper and edit Project\\gradle\\wrapper\\gradle-wrapper.properties files field distributionUrl like this 现在,设置“使用默认的gradle包装器”并编辑Project \\ gradle \\ wrapper \\ gradle-wrapper.properties文件字段distributionUrl,如下所示

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

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值