問題描述
我有一個命令行 apk 生成器,它使用相同的源代碼編譯大量 APK,因此這些應(yīng)用程序具有相同的依賴項.
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 項目需要網(wǎng)絡(luò)連接才能下載依賴項.
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 以防止在構(gòu)建期間訪問網(wǎng)絡(luò).
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
如果它需要網(wǎng)絡(luò)中沒有的東西,而不是嘗試獲取它,你的構(gòu)建將會失敗.
If it needs something from the network that it doesn't have, instead of attempting to fetch it, your build will fail.
這篇關(guān)于如何配置 gradle 以“離線"工作(使用緩存的依賴項)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!