为什么每次导入新的gradle项目时Android Studio都会下载gradle? [英] Why does Android Studio download gradle each time a new gradle project is imported?

查看:999
本文介绍了为什么每次导入新的gradle项目时Android Studio都会下载gradle?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么每次尝试导入新项目时Android Studio都会下载gradle?

Why does Android Studio download gradle every time I try to import a new project?

最初,我导入了一个gradle项目,并自动下载了Gradle 2.1.随后,对于第二个项目导入,它下载了Gradle 1.10.现在,当再次导入第三个项目时,它已经下载了Gradle 2.2.1.

Initially, I imported one gradle project for which Gradle 2.1 was auto-downloaded. Subsequently, for a second project import, it downloaded Gradle 1.10. Now again while importing a third project, it has downloaded Gradle 2.2.1.

发生了什么事?

推荐答案

项目可以声明运行它们所需的Gradle(请参阅项目根目录gradle目录中的gradle.properties文件).

Projects can declare which Gradle they require to run (see gradle.properties file in gradle directory in the root of the project).

Android Studio使用此信息下载并运行正确的版本(实际上不是Android Studio,这是 Gradle Wrapper 在其中运行).这是一件好事.

Android Studio uses this information to download and run the right version (it's actually not Android Studio, it's the Gradle Wrapper running inside it). And it's a good thing.

您能做什么?

  1. 等等.在~/.gradle目录中下载了版本后,它将用于声明相同版本的任何项目.这是一次性缓存.
  2. 在导入项目时禁用包装器的用法. 我真的建议您反对它!因此,您的项目可能无法构建.
  1. Wait. Once you have the version downloaded in ~/.gradle directory, it will be used for any project declaring the same version. It's one-time cache.
  2. Disable the usage of the wrapper when you import the project. I really recommend against it! You project might not build because of that.

这篇关于为什么每次导入新的gradle项目时Android Studio都会下载gradle?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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