艹Android studio直接卡死 不知道怎么回事

 我来答
爱乐悠扬5Z
2016-08-02 · TA获得超过1万个赞
知道小有建树答主
回答量:766
采纳率:100%
帮助的人:290万
展开全部

之前使用eclipse,后来google公司自己推出了一个安卓的开发工具android studio,并且渐渐的停止对eclipse的兼容和支持,所以我也从eclipse跳到使用androidstudio了,但是android studio使用起来时不时的出现死掉卡机卡顿,让我很郁闷,只能干巴巴等着他恢复过来,为了缓解甚至解决这个问题,我采用了两种方法:

方法1:升级自己的电脑配置。我家里的电脑,我自己掏腰包把内存加到8G,并加上了一个固态硬盘,把系统分区(就是C盘)放在固态硬盘上,原来的那个机械硬盘就当从盘存储一些东西,把32位的系统换成64位,结果一试,哇,不在卡了!家里的电脑是咱们的自己,想怎么搞都行,但是公司的电脑怎么办?所以有了方法2.

方法2:设置 android studio的某些参数。方法1的办法当然好,但有的时候,尤其是在公司,公司的电脑,除了使用上面的办法外,还可以设置android studio的某些文件里的参数。首先找到androidstudio的安装目录\bin\studio64.exe.vmoptions这个文件(我的是64位系统,如果你的是32位的系统应该是studio.exe.vmoptions),把它复制到”本账户目录”\.AndroidStudio1.5目录下,先说下这里的”本账户目录”,就是你登录windows的那个账号的目录,如我的是使用Administrator登录的,我的”本账户目录”就C:\Users\Administrator,至于后面的.AndroidStudio1.5是我使用的android studio是1.5的版本,如果你的是别的版本,请参考下图:

然后打开刚刚复制的那个文件如下:


-Xms128m
-Xmx750m
-XX:MaxPermSize=350m
-XX:ReservedCodeCacheSize=96m
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-Djna.nosys=true
-Djna.boot.library.path=

-Djna.debug_load=true
-Djna.debug_load.jna=true
-Djsse.enableSNIExtension=false
-XX:+UseCodeCacheFlushing
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-Didea.platform.prefix=AndroidStudio
-Didea.paths.selector=AndroidStudio

其中Xms表示JVM Heap(堆内存)最小尺寸,Xmx表示JVM Heap(堆内存)最大允许的尺寸, XX:MaxPermSize表示最大允许非堆内存分配尺寸,可以根据自己的电脑配置的高低来设置这三个值,

例如:


-Xms1024m
-Xmx2048m
-XX:MaxPermSize=1024m

其中有一点需要提一下,我看到许多兄弟就直接对androidstudio的安装目录\bin\studio64.exe.vmoptions这个文件进行修改,但我当我打开这个文件时上面提示:

 *DONOT* modify this file directly. If there is a value that you would like tooverride,

 please add it to your user specificconfiguration file.啥意思?就是不让咱们在此文件修改的提示,如果这些参数确实需要修改,自己弄个新的文件在特定的目录(就是我上面方法中的C:\Users\Administrator\.AndroidStudio1.5目录)来覆盖它。为什么不让修改?

官方的解释:

You should not edit any files in the IDEinstallation directory. Instead, you can customize the attributes by creatingyour own .properties or .vmoptions files in the following directories. (Thishas been possible on some platforms before, but it required you to copy andchange the entire contents of the files. With the latest changes theseproperties are now additive instead such that you can set just the attributesyou care about, and the rest will use the defaults from the IDE installation).

纺织管家
2016-08-02 · TA获得超过129个赞
知道答主
回答量:234
采纳率:0%
帮助的人:76.1万
展开全部
可能是你的电脑配置跟不上,as还是需要一定的配置要求的
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式