① First, we close Android Studio (skip this step if it is not started);
② Then we create a new folder in the target location to store the .android/.gradle folders that were originally located in the user directory. Take a folder as an example;
[Note: It is recommended that no spaces be left in the folder name]
③Move the two folders .android/.gradle originally located in the user directory to the newly created folder;
④ Next, we enter the edit interface of **Windows System/Environment Variables**;
[Don’t know how to enter the edit interface? Take a look at this tutorial: Portal ]
⑤ Add the following system variables and save:
Variable name: ANDROID_SDK_HOME Variable value: E:\Android_Studio_Data\
Variable name: GRADLE_USER_HOME Variable value: E:\Android_Studio_Data\ .gradle
⑥ Then we start Android Studio, open the Gradle settings in File -> Settings -> Gradle , change the Gradle user home path to the current path E:\Android_Studio_Data.gradle, and click Apply.