How to Move Gradle Folder for Android Studio
This article is about moving the Gradle directory, .gradle, used by Android Studio, from the default location to another drive. This can be required when a disk drive runs low on space. The .gradle directory can grow to several gigabytes in size as Studio and Gradle gets updates. Another reasons to move the .gradle directory is to try and keep the build process all contained in one location (e.g. if the app project files are on another drive).
On some Windows computers the C: drive may be low on space. This means programs and files may need to be installed and run from another drive. It is not uncommon for a computer to have a small Solid State Drive (SSD) for the operating system (OS), usually the C: drive, and a larger second drive, usually D:, for data and large programs.
Where is .gradle Folder in Windows?
The default location for the files for a Windows user is under the Users directory on the C: drive. So a user called John Doe would have a folder at C:\Users\John Doe. This user directory is where the Windows .gradle folder is located.
Can I Move Android Studio's .gradle Folder to Another Disk?
Android Studio has a setting that can be changed so that Gradle can be located on another drive. With Android Studio running, close any open projects to return to the Welcome to Android Studio dialog. This will prevent any background project tasks getting confused when moving the .gradle folder.
In Windows File Explorer move the .gradle folder to the new location. Move by either by dragging and dropping while holding the Shift key, or using the File Explorer context menu (normally right-click) and selecting cut, and then paste to the new location. Next access the Settings for the Android Studio.
The Global Gradle Settings are under Build, Execution, Deployment in the Build Tools section. Choose the new location of the moved .gradle directory.
Open an app project and check that the project builds correctly to confirm that the Gradle move was successful.
Delete .gradle Folders
At the time of writing this article the version of Gradle used by Studio was over version 4, with version 5 under development. This means older versions are unlikely to be used again. Thus older versions of Gradle in the .gradle folder can be deleted if no longer required. E.g. delete all 1.x folders under the caches and daemon .gradle sub-folders, and delete all gradle-1.x-all and gradle-1.x-bin under .gradle/dists.
- See some Android Studio example projects to learn Android app programming.
- For a full list of the articles on Tek Eye see the full site Index
Author:Daniel S. Fowler Published: