Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android studio 3.1.1 editing build.gradle file slow

Tags:

I have update Android Studio to latest version 3.1.1, but is so slowly , especially when I editing build.gradle file , is there any solution ? (before I use 3.0.1 , that is so fast)

like image 625
forgot2015 Avatar asked Apr 11 '18 09:04

forgot2015


People also ask

Why is Gradle build so slow?

This happens due to the fact that the module needs to be built from the scratch every time. Enable gradle Offline Work from Preferences-> Build, Execution, Deployment-> Build Tools-> Gradle. This will not allow the gradle to access the network during build and force it to resolve the dependencies from the cache itself.

How long does Gradle build take?

In your build. gradle, if you have minifyEnabled for debug, remove it. I had it in my project and it took ~2-3 minutes to build.


1 Answers

It seems like this is only happening in China. Try this solution:

https://stackoverflow.com/a/47342580/501175

According to the answer above, there are two ways you can try:

  1. You need to modify the proxy setting of your Android Studio
  2. Simple add a line 127.0.0.1 search.maven.org to the /etc/hosts file. I am using the second one and it works fine.
like image 174
zijing07 Avatar answered Oct 05 '22 00:10

zijing07