Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent gradlew from download anything?

I am trying to run gradlew on offline machine. It starts from message

Downloading https://services.gradle.org/distributions/gradle-2.10-all.zip

and then fails with exception.

What it wants and how to satisfy it?

like image 325
Suzan Cioc Avatar asked Mar 29 '17 08:03

Suzan Cioc


People also ask

Why does gradle download dependencies every time?

It uses much of internet bandwidth and takes time to import or create a project.

Is gradlew required?

No need to install gradle locally The gradlew script doesn't rely on a local Gradle installation. It goes and fetches a Gradle installation from the internet the first time it runs on your local machine, and caches it. This makes it super-easy for anybody anywhere to clone a project and build it.

Why is gradle keeps downloading itself again and again with Android studio?

Enable offline mode in Android Studio to disable checking for updates everytime. Go to Settings>Compiler>Gradle>Offline mode. If this is enabled the gradle will be told not to connect to internet and check for updates.

What is the use of gradlew file?

Overview. Gradle is commonly used by developers to manage their project's build lifecycle. It's the default choice of build tool for all new Android projects.


1 Answers

Option 1. If you have possibility go online temporary

Command gradlew means you are trying to use Gradle Wrapper. It is a tool for automated downloading of Gradle distribution.

In order to download Gradle Wrapper you have to execute gradlew command with a proper network connection at least once. Make sure you have correct network and proxy settings.

./gradlew build

Only after that you can build a project offline. Example:

./gradlew build --offline

Option 2. Download distribution by hand

Or, alternatively, you could download distribution from official site. Then extract it, add gradle to PATH variable, and run:

gradle build --offline
like image 174
Vyacheslav Shvets Avatar answered Oct 05 '22 16:10

Vyacheslav Shvets