I am setting up flutter for mobile app development without Android Studio. everything has been set except Gradle. For Gradle, I am setting environment variables but I am confused with two variables GRALDE_USER_HOME and GRADLE_HOME.

  1. In the docs we have Configure your system environment for Microsoft Windows users where is written that you could also add the environment variable GRADLE_HOME and point this to the unzipped distribution.

  2. In my project file \gradle\wrapper\, there are also some variables distributionBase and zipStoreBase which are set to GRADLE_USER_HOME,

Are both variables different??? Do we need to set both variables???

content of file


You should set neither, but yes, they are different. GRADLE_HOME refers to the Gradle distribution your are using. If you set it like documented it has no effect alone. It is described to then use that variable in the PATH variable, so that after a version update you can just update that variable instead of PATH directly. But actually you do not need any version installed at all, as practically all Gradle builds should have the 4 wrapper files which define which Gradle version to run the build with, so the installed version is not used anyway. An installed version is typically only used to bootstrap a new build and for that you can also use the wrapper of another build.

The GRADLE_USER_HOME is the place where Gradle stores caches, provisioned JDKs, wrapper-downloaded Gradle distributions and so on. This is by default in ~/.gradle, but you can set it to a different directory where you want those files to be stored at.

The wrapper properties you showed, say to store the distribution in the given subdirectory of the GRADLE_USER_HOME.