Android Studio优化配置

背景

最近Android Studio更新到了V3.5版本,听说是做了一下优化,但是运行还是和以往一样占用很高的CPU和硬盘资源,最近实在是受不了这缓慢的速度,决定研究优化一下。

运行优化

我首先怀疑的是配置java虚拟机的内存过小,导致频繁的GC导致的资源占用率过高,找到AS安装目录\bin\studio.exe.vmoptions文件,如果是系统是64位,找到studio64.exe.vmoptions文件。
修改配置,增大jvm heap大小。

-Xms2048m
-Xmx2048m
-XX:MaxPermSize=2048m
-XX:ReservedCodeCacheSize=1024m

Gradle编译优化

在gradle.properties文件增加如下配置

# The Gradle daemon aims to improve the startup and execution time of Gradle.
# When set to true the Gradle daemon is to run the build.
# TODO: disable daemon on CI, since builds should be clean and reliable on servers
org.gradle.daemon=true

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
org.gradle.parallel=true

# Enables new incubating mode that makes Gradle selective when configuring projects.
# Only relevant projects are configured which results in faster builds for large multi-projects.
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:configuration_on_demand
org.gradle.configureondemand=true

然后在settings配置如下图
Android Studio优化配置_第1张图片

致谢

欢迎点赞和评论。

你可能感兴趣的:(Android,Studio,android,stuio,随笔)