近期使用Android studio 开发app,编译的时候特别卡,常常卡死。我的机器 i3 + 8G,按道理来说流畅的跑个androidstudio还是绰绰有余的...

于是在各大论坛寻找解决方式,在此记录下来。让同病相连的弟兄们能够早点解脱....

方法一:开启gradle单独的守护进程

在以下的文件夹以下创建 gradle.properties 文件:

  • /home/<username>/.gradle/ (Linux)
  • /Users/<username>/.gradle/ (Mac)
  • C:\Users\<username>\.gradle (Windows)

并在文件里添加:

org.gradle. daemon= true

同一时候改动项目下的 gradle.properties 文件也能够优化:

<span style="font-size:14px;"># Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Settings specified in this file will override any Gradle settings
# configured through the IDE.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# 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
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize= 512 m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF- 8
# 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</span>

同一时候上面的这些參数也能够配置到前面的用户文件夹下的gradle.properties文件中。那样就不是针对一个项目生效,而是针对全部项目生效。

上面的配置文件主要就是做, 增大gradle执行的java虚拟机的大小,让gradle在编译的时候使用独立进程,让gradle能够平行的执行。

方法二:添加Androidstudio的执行内存

操作例如以下图:

1。打开 Androidstudio的安装路径下的
bin 文件夹

2,找到 studio.exe.vmoptions 和 studio64.exe.vmoptions 文件

3,改动 以上2个文件里的值 (下图是我改动后)

这些值起码在原有的基础上乘以2。假设是内存壕的话。能够尽可能的大。

我的Androidstudio 经过上述配置后。能够跑得飞起来了,哈啊哈!

兄弟还在等什么。!飞起来吧!

。骚年

最新文章

  1. mysql集群(主从)
  2. html、css、javascript、JSP 、xml学习顺序应该是怎样的呢?
  3. php提示:Call to undefined function curl_init
  4. UVa 10791 (唯一分解) Minimum Sum LCM
  5. scrapy使用代理
  6. CentOS 6.5配置mysql
  7. 1218: [HNOI2003]激光炸弹
  8. 如何在一个项目中同时包含mvc建站、webapi接口
  9. Aps.net中基于bootstrapt图片上传插件的应用
  10. 团队项目第二阶段个人进展——Day8
  11. 安装netcat(-bash: netcat: command not found)
  12. 剑指offer 9.递归和循环 变态跳台阶
  13. SQL 服务器 - RDBMS
  14. Codeforces Beta Round #61 (Div. 2)
  15. 1S - 平方和与立方和
  16. python---补充django中文报错(2),Django3.5出错
  17. 跟我学SharePoint 2013视频培训课程——什么是SharePoint 2013(1)
  18. 腾讯微博API时间线相关接口返回的微博信息中head值使用问题
  19. javascript 构造函数类和原型 prototyp e定义的属性和方法的区别
  20. SQL语句嵌套if

热门文章

  1. Jenkins学习总结(4)——持续集成,持续交付,持续部署之间的区别
  2. jvm 虚拟机参数_栈内存分配
  3. 玩转iOS开发 - Runloop 具体解释
  4. Raspberry PI 系列 —— 裸机点亮LED灯
  5. HDOJ 1874 畅通project续
  6. 【IPC进程间通讯之三】内存映射文件Mapping File
  7. 使用Powershell 的获取别的机器WMI类失败解决方法!
  8. 132.try throw catch介绍
  9. POJ 3368 线段树
  10. 递归版快速排序-JS代码