How to configure gradle to work “offline” (using cached dependencies)

心不动则不痛 提交于 2019-11-26 17:42:55

Gradle does a good job of avoiding redownloading artifacts, but you can pass --offline to grade to prevent from accessing the network during builds. If it needs something from the network that it doesn't have, instead of attempting to fetch it, your build will fail.

Android Studio

In Android Studio you can make gradle to build your apps fully offline by activating this option:

Settings -> Build, Execution, Deployment -> Build tools -> Gradle

Gradle CLI

In Gradle command line interface you can get this done by using --offline flag. What Documentations say about this flag:

Specifies that the build should operate without accessing network resources. See Section 52.9.2, “Command line options to override caching”.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!