如何在Gradle中启用丢失的Android SDK软件包的自动下载 [英] How to enable automatic download of missing Android SDK packages in Gradle
问题描述
在Google I/O 2016期间的 Android开发工具中的新功能了不起的新功能很快被提及:Android Gradle插件现在可以自动从Android SDK下载缺少的依赖项.
During Google I/O 2016's What's new in Android development tools a great new feature was quickly mentioned: Android Gradle plugin can now automatically download missing dependencies from Android SDK.
Android Gradle插件2.2.0-alpha4中也提到了它发行说明.
It's also mentioned in Android Gradle plugin 2.2.0-alpha4 release notes.
如何启用它?
推荐答案
在项目的根文件夹的gradle.properties
文件中,添加以下行:
In gradle.properties
file in your project's root folder add the following line:
android.builder.sdkDownload=true
注意:在撰写本文时,此选项是实验性的.到目前为止,它似乎正在下载缺少的构建工具和平台,但并未尝试根据
Note: at the time of writing this option is experimental. It looks like so far it downloads missing build tools and platforms, but doesn't attempt to update repositories where the support libraries or Google Play Services libraries live according to a bug report/feature request.
由于现在支持maven.google.com而不是本地存储库中的Google库和其他Google库,因此上面的注释并不重要.
since now support libraries and other libraries from Google live on maven.google.com and not in local repositories, the note above isn't as important.
这篇关于如何在Gradle中启用丢失的Android SDK软件包的自动下载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!