Android Studio3.x默认缓存目录修改记录

1. android studio默认缓存路径

Android studio缓存路径默认设置在C盘的C:\Users\{用户名}\,这样很容易导致占用C盘过多的空间, 可以把android studio的缓存路径设置到别的盘符下,释放C盘的空间,android studio主要包括.android,android studiox.x和.gradle这3个文件夹

  • .android文件夹是存放android虚拟机相关的文件夹

  • .AndroidStudiox.x存放android studio相关的配置

  • .gradle是存储gradle相关的配置和本地缓存

2.下面将分别介绍如何修改这些缓存文件夹的路径

2.1 修改.android文件夹

  • 1.添加ANDROID_SDK_HOME环境变量,设置自己自定义目录:M:\cache

  • 2.修改新路径(M:\cache\.android\avd)下的xxx.ini文件内的路径信息,修改完成需要重启生效。

# 原来目录下配置信息

avd.ini.encoding=UTF-8
path=C:\Users\{用户名}\.android\avd\Pixel_XL_API_27.avd  # 主要修改这个
path.rel=avd\Pixel_XL_API_27.avd
target=android-27

#修改后的配置信息

avd.ini.encoding=UTF-8
path=M:\cache\.android\avd\Pixel_XL_API_27.avd
path.rel=avd\Pixel_XL_API_27.avd
target=android-27

2.2 修改 .AndroidStudio*.*文件夹

进入android studio安装目录的bin文件夹,打开idea.properties文件,找到idea.config.pathidea.system.pathidea.plugins.pathidea.log.path修改这4个配置项。把${user.home}替换为自己的路径:M:\cache\,并把前面的#去掉。


# 默认配置

#---------------------------------------------------------------------
# Uncomment this option if you want to customize path to IDE config folder. Make sure you're using forward slashes.
#---------------------------------------------------------------------
# idea.config.path=${user.home}/.AndroidStudio/config

#---------------------------------------------------------------------
# Uncomment this option if you want to customize path to IDE system folder. Make sure you're using forward slashes.
#---------------------------------------------------------------------
# idea.system.path=${user.home}/.AndroidStudio/system

#---------------------------------------------------------------------
# Uncomment this option if you want to customize path to user installed plugins folder. Make sure you're using forward slashes.
#---------------------------------------------------------------------
# idea.plugins.path=${idea.config.path}/plugins

#---------------------------------------------------------------------
# Uncomment this option if you want to customize path to IDE logs folder. Make sure you're using forward slashes.
#---------------------------------------------------------------------
# idea.log.path=${idea.system.path}/log

#---------------------------------------------------------------------


#修改后配置

#---------------------------------------------------------------------
# Uncomment this option if you want to customize path to IDE config folder. Make sure you're using forward slashes.
#---------------------------------------------------------------------
 idea.config.path=M:/cache/.AndroidStudio/config

#---------------------------------------------------------------------
# Uncomment this option if you want to customize path to IDE system folder. Make sure you're using forward slashes.
#---------------------------------------------------------------------
 idea.system.path==M:/cache/.AndroidStudio/system

#---------------------------------------------------------------------
# Uncomment this option if you want to customize path to user installed plugins folder. Make sure you're using forward slashes.
#---------------------------------------------------------------------
 idea.plugins.path=${idea.config.path}/plugins
 
# 如果插件下载后重启,导致消失,则把`idea.plugins.path`值改成`${idea.system.path}/plugins`,
# 即`idea.plugins.path=${idea.system.path}/plugins`
# 因为插件下载是在`system`下,如果是zip格式则需要解压,安装则在`config`目录下

#---------------------------------------------------------------------
# Uncomment this option if you want to customize path to IDE logs folder. Make sure you're using forward slashes.
#---------------------------------------------------------------------
 idea.log.path=${idea.system.path}/log

#---------------------------------------------------------------------


3.修改.gradle文件夹

进入android studio安装目录的bin文件夹,打开idea.properties文件,在文件中添加:gradle.user.home=M:/cache/.gradle

#修改后配置

#---------------------------------------------------------------------
# Uncomment this option if you want to customize path to IDE config folder. Make sure you're using forward slashes.
#---------------------------------------------------------------------
 idea.config.path=M:/cache/.AndroidStudio/config

#---------------------------------------------------------------------
# Uncomment this option if you want to customize path to IDE system folder. Make sure you're using forward slashes.
#---------------------------------------------------------------------
 idea.system.path==M:/cache/.AndroidStudio/system

#---------------------------------------------------------------------
# Uncomment this option if you want to customize path to user installed plugins folder. Make sure you're using forward slashes.
#---------------------------------------------------------------------
 idea.plugins.path=${idea.config.path}/plugins

#---------------------------------------------------------------------
# Uncomment this option if you want to customize path to IDE logs folder. Make sure you're using forward slashes.
#---------------------------------------------------------------------
 idea.log.path=${idea.system.path}/log
 
# gradle 目录配置

 gradle.user.home=M:/cache/.gradle

#---------------------------------------------------------------------

最后打开工程,在Settings->Build,Execution,Deployment->Gradle修改Gradle user home: M:/cache/.gradle

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值