Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop gradle from downloading every time

Tags:

gradle

I have installed gradle in Ubuntu 16.04.
Here is the output for gradle -v

------------------------------------------------------------
Gradle 2.10
------------------------------------------------------------

Build time:   2016-01-26 15:17:49 UTC
Build number: none
Revision:     UNKNOWN

Groovy:       2.4.5
Ant:          Apache Ant(TM) version 1.9.6 compiled on July 8 2015
JVM:          1.8.0_101 (Oracle Corporation 25.101-b13)
OS:           Linux 4.4.0-38-generic amd64

But even now, whenever I create a new project based on gradle v2.10, it downloads it and then builds the project. According to the tutorials, after installing it, I shouldn't need to download it again. What is the problem here?

like image 801
demonSlayer Avatar asked Sep 26 '16 06:09

demonSlayer


People also ask

How do I stop Gradle download?

If you want to explicitly stop running Daemon processes for any reason, just use the command gradle --stop .

Why does Gradle download every time?

Basically it downloads the Gradle build files for your current project according to its version and this whole work is done by your gradle wrapper which actually looks towards the basic requirement for your project and downloads the files according to that so whenever you are going to use any another projects of same ...

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.

Why does Android Studio download Gradle for every project?

Android Studio uses Gradle, an advanced build toolkit, to automate and manage the build process, while allowing you to define flexible custom build configurations. Each build configuration can define its own set of code and resources, while reusing the parts common to all versions of your app.


2 Answers

I think you have two concepts mixed up:

  1. A manual installation of gradle (gradle.bat / gradle.sh)
  2. The gradle wrapper (gradlew.bat / gradlew.sh)

When you mention executing gradle -v this has absolutely no effect on the gradle wrapper. The wrapper works independently of any manually installed gradle versions.

Since you are referencing gradle being downloaded I assume you are discussing the gradle wrapper (gradlew). The wrapper will first check if it has downloaded the version previously by checking the cache stored under $GRADLE_USER_HOME so will only ever download each version once. Subsequent gradlew invocations will use the previously downloaded/unzipped installation.

like image 76
lance-java Avatar answered Oct 30 '22 13:10

lance-java


you will have to replace url with local path like this

distributionUrl = file\:///e:/android/gradle-2.10-bin.zip

and comment

distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip

in gradle-wrapper.properties

like image 8
sansoft infotech Avatar answered Oct 30 '22 12:10

sansoft infotech