问题描述
我有一个命令行 apk 生成器,它使用相同的源代码编译大量 APK,因此这些应用程序具有相同的依赖项.
I have a command line apk generator which compiles a lot of APKs using the same source code, so these apps have the same dependencies.
在 gradle 文档中我可以看到:
In the gradle documentation I can see this:
Gradle 项目需要网络连接才能下载依赖项.
The Gradle project needs network connectivity to download dependencies.
我知道可以将 gradle 配置为离线工作,而不是下载它为其他 apk 下载的相同依赖项.如何激活这种离线模式?
I know that it is possible to configure gradle to work offline and not download the same dependencies that it has downloaded for other apks. How can this offline mode be activated?
推荐答案
Gradle 在避免重新下载工件方面做得很好,但是你可以通过 --offline
到 Gradle 以防止在构建期间访问网络.
Gradle does a good job of avoiding re-downloading artifacts, but you can pass --offline
to Gradle to prevent from accessing the network during builds.
例如
gradle --offline build
如果它需要网络中没有的东西,而不是尝试获取它,你的构建将会失败.
If it needs something from the network that it doesn't have, instead of attempting to fetch it, your build will fail.
这篇关于如何配置 gradle 以“离线"工作(使用缓存的依赖项)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!