My machine has 8 GB of RAM. I installed Android Studio 1.1.0 and applied everything they posted here.
Everything works fine with a small Hello world app. But when I start editing build.gradle
of a big project which we had moved from Eclipse, the IDE hangs for 20 or 30 seconds. It hangs even if I don't add or remove any lines. Even if I just press Enter. Besides I don't see any processes running (indexing, syncing, etc) at the bottom.
I checked File -> Settings -> Gradle
, and Use auto-import
was unchecked.
As they suggested, I ran jstack -l <pid> > dump.txt
and posted a message along with dump.txt
on https://code.google.com/p/android/issues/detail?id=82706#c35
I can't attach the same dump.txt
here because it contains about 800 lines.
After some time looking into this issue, I found that it is an active issue among the Android Issue Tracker forum.
https://code.google.com/p/android/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Status%20Priority%20Owner%20Summary%20Stars%20Reporter%20Opened&groupby=&sort=&id=59965
You'll see my comment in that thread but I'll post it here as well
I did find out WHY my build.grade would hang upon touching (any amount of editing once so ever).
I had a statement where I would iterate over all the variants and would then iterate over each variant's outputs and do a filter among an xml file. Commenting the filter portion out would remove the hanging/freezing problem. In fact only iterating over the first output (of the first variant) would drastically reduce this lag time, still, very annoying.
I would suggest starting your build.gradle file from scratch and adding parts progressively until you come across the portion in which hangs the editing process.
EITHER WAY, this hang shouldn't happen since I'm merely editing the file, not compiling nor running.
Hopefully this can help someone
In your gradle.properties files uncomment the 3rd line below, if not exist create one yourself
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx1024m -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
This help me a lot in android-studio performance
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With