Every time edit build.gradle file Android studio will frozen

Viewed 744

I am using Android studio 3.1 Canary 3 with gradle 4.3.1. It's very slow for me to visit maven.org, but when I edit build.gradle file in Android studio, it will send request to search.maven.org. As a result I must wait a minute or more for Android studio to response after edit build.gadle file, can anyone known how to fix it, I already try follow suggest:
1、Install Google Repository and Android support repository,
2、Set http and https proxy,

Setting http and https proxy works for me but still it is slow. While installing repository doesn't work at all, as the package is already installed before. So, I think preventing Android studio from sending request to search.maven.org is a good idea. If anyone known how to fix it, please let me known, thanks in advance.

1 Answers

It seems that this issue mainly happens in China. Every time when we edit build.gradle file Android studio will send request to search.maven.org then frozen and after the server response the request Android studio will unfrozen. So add 127.0.0.1 search.maven.org to hosts file can solve this issue, but sometimes we also need to visit search.maven.org.
For me, I am using Chrome with SwitchyOmega plugin installed so I first add 127.0.0.1 search.maven.org to /etc/hosts then add pac rule for this site in Chrome and I find everything work fine, Android studio will not frozen and I still can visit search.maven.org.

Related