Android Studio is slow (how to speed up)?
I recently upgraded from Eclipse to Android Studio and I'm not really liking the experience. I'm comparing them both on a Windows 7 64 bit ultimate with 16GB of ram and Intel i7 4770 running NVidia Geforce 780 with the latest NVidia drivers if it matters and I'm running the latest JDK and the latest Android Studio.
The Android Studio is very slow in building the project which I can live with but it's also extremely resource intensive and sometimes slows down the PC to a crawl.
Whenever I'm building or running anything in AS, my PC seems to become extremely sluggish. It also causes flickering of screen and occasionally blanking my second monitor if I click on "Gradle build running" spinner which I find very odd. The RAM usage also shoots up to ~3GB which I find excessive for doing nothing (this is when it's idle after a few builds).
In addition, the panels at the bottom of AS keep jumping around which is a horrible user experience (moves from Android
to Messages
to Version Control
or anything else on an ad-hoc basis depending on what's happening which is very, very annoying).
What I would like to know is basically:
1) How do I make Android Studio run better? I may be doing something wrong or missing some updates that I'm not aware of and I'm sure others have also noticed these behaviors and have found some solutions to it.
2) How do I "pin" the bottom panels so that they don't jump around and instead, let me, the user, navigate to them when I wish to instead of automatically switching them?
Many thanks and my apologies again if it's not the correct place for these questions.
Edit 1 Some more comments:
stable
build as of today. The build is Android Studio 1.2.2 Build # AI-141.1980579, Build on June 3, 2015
to sum it up
1) in AndroidStudio's settings > compile
enable checkbox named Compile independent modules in parallel
.
2) Under Help> Edit Custom VM Options
I have:
-Xms1024m
-Xmx4096m # <------ increase this to most of your RAM
-XX:MaxPermSize=1024m
-XX:ReservedCodeCacheSize=440m
-XX:+UseCompressedOops
-XX:-HeapDumpOnOutOfMemoryError
-Dfile.encoding=UTF-8
PS - Some people say Note, instead of VM options, it's better to combine can be overriden by combining those lines into one line single command in gradle.properties, like this :
org.gradle.jvmargs=-Xms1024m -Xmx4096m ......
3) I have an old dual core with 4GB ram, running ubuntu. Qs command line option I have only --offline
(which specifies that the build should operate without accessing network resources). I also enabled the remaining checkboxes and now it's running ok:
Make project automatically
Use in-process building Configure on demand
Check the AndroidStudio's settings, under compile that the checkbox Compile independent modules in parallel
is enabled.
Under Vmoptions I have
-Xmx2048m -XX:MaxPermSize=1024
I have an old dual core with 4GB ram, running ubuntu. Qs commandline option I have only --offline
, which specifies that the build should operate without accessing network resources. I enabled also the remaining checkboxes:
Configure on demand
and it is running ok
Edit
It is possible to provide additional options through studio.vmoptions
located at (just replace XX with version):
Windows : go to %USERPROFILE%.AndroidStudioX.Xstudio.exe.vmoptions
(or studio64.exe.vmoptions
)
Mac : ~/Library/Preferences/.AndroidStudioX.X/studio.vmoptions
Linux : ~/.AndroidStudioX.X/studio.vmoptions
(and/or studio64.vmoptions
)
Increasing the value of -Xmx
should help a lot. Eg
-Xms1024m
-Xmx4096m
-XX:MaxPermSize=1024m
-XX:ReservedCodeCacheSize=256m
-XX:+UseCompressedOops
will assign 4G as max heap, with initial value of 1G
Edit:
On windows the defaults are stored into C:Program FilesAndroidAndroid Studiobin*.vmoptions
. The IDE allows you to tweak those values through Help->Edit Custom VM options
(thanks to @Code-Read
for pointing it out).
Tips to make android studio fast:
Enable Offline Work:
Offline work
box. Gradle
) and add --offline
to Command-line Options
text box. Improve Gradle Performance
gradle can be optimized too. The easy way is to modify the settings in global gradle.properties
(create it if not exists in the following folders: Windows - C:usersyour_name.gradle
; Linux- /home/<username>/.gradle/
; Mac- /Users/<username>/.gradle/
; ) and in that file, add these two lines:
org.gradle.daemon=true
org.gradle.parallel=true
For More: http://www.viralandroid.com/2015/08/how-to-make-android-studio-fast.html
I detected another reason - Thumbs.db , which affected performance badly.
Go to File > Settings > Editor > File Types
and in field Ignore files and folders add this: Thumbs.db;
Now, Android Studio runs like a charm.
链接地址: http://www.djcxy.com/p/90530.html上一篇: AMD处理器启动AVD时出错