Is there any way to run gradle in “offline” mode. I would expect if the artifact repo is not available that the build just uses the latest artifacts in the cache.
Starting with 1.0-milestone-8 you can pass ‘–offline’.
When I run gradle without no network connection I still can build. Is it possible that gradle uses the “–offline” option as default when no network is available? Because I also can build without network connection??
Gradle wants to be convenient to use and we’ve put a lot of effort to avoid doing remote hits if possible. This does not mean that if don’t have network Gradle implicitly runs with --offline
Hope that helps!
But why is it possible that I can make a full build without network connection?
Sorry for answering with a question but why would it be impossible? Gradle caches the dependencies locally so it does not have to reach out to the web with each build. The snapshots / dynamic versions are cached by default for 24 hours.
What if you are online but a particular resource is not available? It seems that gradle just times out and fails rather than using the latest cached version of the resource. Perhaps a warning would be more appropriate than a fail?
Also what does the “Offline work” tick box do in Android Studio? Does that mean the build only ever uses cached resources rather than go to the network?