为什么编辑XML文件或改变设计时,Android的工作室正在放缓? [英] Why Android Studio is slowing down when editing xml file or changing the design?

查看:156
本文介绍了为什么编辑XML文件或改变设计时,Android的工作室正在放缓?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有英特尔酷睿i7和8GB的RAM和2GB图形惠普Envy笔记本电脑,有时仍然机器人工作室stucks当我使用XML或设计的应用程序。是否与我的笔记本电脑或Android工作室什么问题?

I have a Hp envy notebook with Intel i7 and 8gb ram and 2gb graphics, still sometimes android studio stucks when I am working with xml or design the app. Is there any problem with my laptop or android studio?

推荐答案

这可能是因为没有进行足够多的堆内存。你可能会想尝试在这个博客中提到的第一种技术:消除时滞和放大器;口吃Android Studio中

It's probably because there's not enough heap memory for AS. You might want to try the first technique mentioned in this blog: Eliminate Lags & Stutters in Android Studio.

链接的内容

增加的Andr​​oid Studio的内存堆:

Android的工作室,就像其他Java应用程序,是著名的运行时占用的内存量疯狂。除非足够的内存分配给在推出的IDE磁盘交换,将开始踢,如果你不使用一个SSD,上帝保佑你。

Android Studio, like other Java applications, is known for hogging an insane amount of memory while running. Unless enough memory is allocated to the IDE at launch, disk swapping will start kicking in and if you're not using a SSD, God bless you.

打开文件 [AS安装文件夹] \\ BIN \\ studio64.exe.vmoptions studio.exe.vmoptions ,这取决于你使用的版本。

Open the file [AS Installation Folder]\bin\studio64.exe.vmoptions or studio.exe.vmoptions, depending on which version you're using.

在它,你很可能会发现在上面这两条线:

In it you're likely to find these two lines at the top:

-Xms128m
-Xmx750m

这两个值提高到合理的东西,例如, -Xms256 -Xmx1024
你可以提高第二个值2048,如果你喜欢;我的同事其计算机的RAM 8G没有找到任何-Xmx2048无论问题。

Increase the two values to something reasonable, e.g. -Xms256 and -Xmx1024. You can boost the second value to 2048 if you like; my coworker whose computer has 8G of RAM doesn't find any issue with -Xmx2048 either.

大功告成后,重新启动AS,如果您在设置/外观检查显示内存指示,你会看到这样的事情在右下角:

After you're done, restart AS and if you've checked Show memory indicator in Settings/Appearance, you'll see something like this at the bottom-right corner:

加快建设摇篮时间

原因之一开发商仍hesistant沟Eclipse是因为摇篮中。
虽然它确实是一个很好的构建系统和有向使用它许多好处,即使是最简单的摇篮呼叫pretty缓慢而费时的。因此,我们的工作流程包括了很多不可避免的等待,有时我们甚至会忘记需要为完成其艰苦建设进程后进行测试的。
有几件事情我们做,以提高摇篮的速度。

One of the reasons developers are still hesistant to ditch Eclipse is because of Gradle. Although it's indeed a nice build system and there are many benefits to using it, even the simplest Gradle calls are pretty slow and time-consuming. As a consequence, our workflow includes a lot of unavoidable waiting, and sometimes we even forget what needs to be tested after AS finishes its laborious building processes. There are a few things we do to boost Gradle's speed.

首先,到设置/编译器和检查一切,除了自动第二个选项生成项目。
对于VM选项,我们使用这些配置:

First, go to Settings/Compiler and check everything, except for the 2nd option Make project automatically. For VM Options, we use these configurations:

-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

接下来,添加以下行gradle.properties在项目目录:

Next, add the following lines to gradle.properties in your project directory:

org.gradle.daemon=true
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.parallel=true
org.gradle.configureondemand=true

与硬件虚拟化加速模拟器

虽然Android模拟器是不是Android的Studio的一部分,这是非常值得一提的是,如果你使用支持硬件虚拟化的新的英特尔CPU之一,模拟器可以惊人的快。看看这篇文章如何将其设置在机器上。

Although the Android emulator is not part of Android Studio, it's well worth mentioning that if you're using one of the newer Intel CPUs which support hardware virtualization, the emulator can be amazingly fast. Check out this article for how to set it up on your machine.

这篇关于为什么编辑XML文件或改变设计时,Android的工作室正在放缓?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆