'Error:Unknown host 'dl.google.com' You may need to adjust the proxy settings in Gradle

I am getting this error in android studio 3.0.

Unknown host 'dl.google.com' You may need to adjust the proxy settings in Gradle

I have checked my auto proxy option already.

enter image description here



Solution 1:[1]

I was also having the same problem. I tried the following and it's working for me:

Windows

Go to : File > Settings > Appearance & Behavior > System Settings > HTTP Proxy [Under IDE Settings] Enable following option Auto-detect proxy settings

Mac

Go to : Android Studio > Preferences > Appearance & Behavior.. etc

You can also use the test connection button and check with google.com to see if it works or not.

Solution 2:[2]

In my case this worked:

File>invalid caches/restart >invalid and restart

Solution 3:[3]

Also, check the internet connection and try again clean and build it's worked for me.

Solution 4:[4]

Your system needs to be online at the time you are building the project first time for the dependencies you have added. Dependencies are downloaded from the google and jcenter servers. After you build the project then you don't need internet connection because dependencies will be available offline.

Solution 5:[5]

In most cases, it happens due to the internet not being connected or the internet speed is too slow. Just check the internet connection and run again.

Solution 6:[6]

This problem usually occurs when we change your project from one pc to another . the proxy of the system is disabled and the solution that worked for me is : File > Settings > Appearance & Behavior > System Settings > HTTP Proxy [Under IDE Settings] Enable following option Auto-detect proxy settings

Solution 7:[7]

The issue is reproduced on Android Studio 2020.3.1 Arch linux Gradle 7.2 JDK 11

Fixed by setting HTTP Proxy as on the screenshot enter image description here

Solution 8:[8]

you just need to reconnect your phone with android studio and then install or run your program

Solution 9:[9]

Basically when u add some new dependencies you require an internet connection to download the dependencies from the internet. By default the Android Studio as set the option to connecting to the internet to get a proper flow. But if u cant connect to the internet, work with the gradle in offline mode and later when the internet comes again...it will automatically download the necessary files in background!

Solution: Click on Enable gradle offline mode and sync the project!

Solution 10:[10]

This error appears if its have not compatible versions of Android Gradle plugin and Gradle wrapper. This versions works for me:

project_dir/build.gradle

buildscript {
dependencies {
        classpath('com.android.tools.build:gradle:3.5.1')
    }
}

project_dir/gradle/wrapper/gradle-wrapper.properties

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

Solution 11:[11]

please check your gradle wrapper, there are 2 gradle wrapper, one is in library folder, and one is in gradle folder. probably the version of both gradle wrapper is different. i solve my case by make them as a same version..

Solution 12:[12]

I was facing the same error even after trying every possible combination of proxy settings, invalidate cache and restart.

The error vanished as soon as I switched my internet connection from wifi to mobile hotspot. Strange.

Solution 13:[13]

Restarting emulator worked for me.

Solution 14:[14]

In my case, after I config kotlin for project I face this problem.

After 30 minutes try 'Auto proxy' and learn about proxy with no hope, I see suddenly I see

repositories {
    mavenCentral()
}

in the end of my build.gradle. Then I delete it and it working.
The most interesting is after it working, I put above line to gradle again but it still working. So maybe it is not a root problem, however I think it may bring some luck in some case.

Currently, I use Window and AndroidStudio 3.4.2

Solution 15:[15]

In current android studio 3.5, simply go to file -> Setting, search "HTTP" in search bar, Enable Auto-detect proxy settings, click Ok to make the changes effective.

Solution 16:[16]

update classpath 'com.android.tools.build:gradle:4.1.1' in gradle file of project and distributionUrl=https://services.gradle.org/distributions/gradle-6.5-bin.zip to latest. in gradle-wrapper.properties

Solution 17:[17]

My case was resolved by changing the IP and using the VPN. Because firebase.google.com did not load for me. The problem was solved when the website loaded for me and I rebuilt it.