Android Stuido 好卡怎么办?不要急,兄弟来教你
2024-08-31 14:25:20
近期使用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 经过上述配置后。能够跑得飞起来了,哈啊哈!
!
!
兄弟还在等什么。!飞起来吧!
。骚年
最新文章
- mysql集群(主从)
- html、css、javascript、JSP 、xml学习顺序应该是怎样的呢?
- php提示:Call to undefined function curl_init
- UVa 10791 (唯一分解) Minimum Sum LCM
- scrapy使用代理
- CentOS 6.5配置mysql
- 1218: [HNOI2003]激光炸弹
- 如何在一个项目中同时包含mvc建站、webapi接口
- Aps.net中基于bootstrapt图片上传插件的应用
- 团队项目第二阶段个人进展——Day8
- 安装netcat(-bash: netcat: command not found)
- 剑指offer 9.递归和循环 变态跳台阶
- SQL 服务器 - RDBMS
- Codeforces Beta Round #61 (Div. 2)
- 1S - 平方和与立方和
- python---补充django中文报错(2),Django3.5出错
- 跟我学SharePoint 2013视频培训课程——什么是SharePoint 2013(1)
- 腾讯微博API时间线相关接口返回的微博信息中head值使用问题
- javascript 构造函数类和原型 prototyp e定义的属性和方法的区别
- SQL语句嵌套if