Android Studio Gradle Cache folder settings

Source: Internet
Author: User

========================================================
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.