Burhan Khanzada
Burhan Khanzada

Reputation: 1076

How to set custom path for .gradle directory for android build in flutter

I want to use custom path for .gradle folder instead of $USER_HOME/.gradle because i am already developing android apps and changed this path to custom path from which it does not affect if whenever i install new windows so i can save me from downloading all that files and different version of gradle wrapper again and again so when now i start learning flutter i realize that its always creating that folder in my $USER_HOME/.gradle directory and there is no option in flutter to change this behavior and i also tried to open the android folder of flutter project from android studio and try to change the path from there but this doesn't help either

Upvotes: 5

Views: 6684

Answers (1)

Burhan Khanzada
Burhan Khanzada

Reputation: 1076

Update 1 - Easy way for windows

set environment

  • Set GRADLE_USER_HOME as D:\gradle\.gradle

Solution for this is to add this line set GRADLE_USER_HOME=(D:\android\.gradle or your custom path) // remove that brackets in android\gradlew.bat file at the first line and that's it now you can use your old gradle download files

Upvotes: 1

Related Questions