========================================================
Qiujuer
Blog: Blog.csdn.net/qiujuer
Website: www.qiujuer.net
Open Source Library: github.com/qiujuer/genius-android
Reprint Please specify source: http://blog.csdn.net/qiujuer/article/details/44257993
--open source of learning, for open source, beginner's mentality, with June mutual encouragement!
========================================================
In "Android-studio Cache folder Configuration" We said how to configure the cache folder, but in the actual use I found that the Gradle cache folder settings do not seem to take effect, although we have set in Android-studio.
To this I have made a certain exploration, and combined with foreign resources summed up the following several methods to set up.
Change the configuration file
You can change files in the following two places:
- Idea.properties (see "Android-studio Cache Folder Configuration" for specific locations)
- Gradle.properties (this file is available in every Android-studio project)
In which we add this sentence:
gradle.user.home=D:/Cache/.gradle
Working with environment variables
Add gradle_user_home to your environment variable and point to your new address and you can also use commands to do so.
$ export GRADLE_USER_HOME=D:/Cache/.gradle$ gradle -d -r07:36:40.020 [main] INFO org.gradle.launcher.Main - Starting Builder07:36:40.120 [main] DEBUG org.gradle.launcher.Main - Gradle user home: D:/Cache/.gradle...
Through System Properties
We can also use Java system property changes to update, in the properties we can use:gradle_opts or java_opts, also through the command execution:
$ export GRADLE_OPTS=-D gradle.user.home=D:/Cache/.gradle$ gradle -d07:36:40.020 [main] INFO org.gradle.launcher.Main - Starting Builder07:36:40.120 [main] DEBUG org.gradle.launcher.Main - Gradle user home: D:/Cache/.gradle...
Self-gradle with parameters
There was a bug in the Gradle official that Android-studio failed to change the cache successfully, and then the official answer was to make changes using Gradle's own command line.
on the command line of the Gradle: -G and –gradle-user-home the same as the two commands, you can configure the cache folder by one of these two commands:
$ gradle -g D:/Cache/.gradle -d07:36:40.020 [main] INFO org.gradle.launcher.Main - Starting Builder07:36:40.120 [main] DEBUG org.gradle.launcher.Main - Gradle user home: D:/Cache/.gradle...$ gradle --gradle-user-home=D:/Cache/.gradle -d07:36:40.020 [main] INFO org.gradle.launcher.Main - Starting Builder07:36:40.120 [main] DEBUG org.gradle.launcher.Main - Gradle user home: D:/Cache/.gradle...
Conclusion
I'm sorry for not being fully effective in the previous chapter, I often use the last method in this article because it is simple and straightforward.
I wish you a happy coding ~ ~
========================================================
Qiujuer
Blog: Blog.csdn.net/qiujuer
Website: www.qiujuer.net
Open Source Library: github.com/qiujuer/genius-android
Reprint Please specify source: http://blog.csdn.net/qiujuer/article/details/44257993
--open source of learning, for open source, beginner's mentality, with June mutual encouragement!
========================================================
Android Studio Gradle Cache folder settings