Reputation: 233
Error:Unknown host 'This is usually a temporary error during hostname resolution and means that the local server did not receive a response from an authoritative server'. You may need to adjust the proxy settings in Gradle.
Enable Gradle 'offline mode' and sync project
Learn about configuring HTTP proxies in Gradle
Upvotes: 13
Views: 59537
Reputation: 429
I got the same error and solved the problem using following instruction.
Go to your project level gradle build script add maven { url"https://jitpack.io"} into allprojects.
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
Upvotes: 7
Reputation: 41
This worked for me.
allprojects {
repositories {
google()
jcenter()
maven {url"https://jitpack.io"}
}
}
Upvotes: 1
Reputation: 11
This worked for me: It happens when you are normally offline. Just turn on your internet connection and retry building the app again. Otherwise, you can use an offline or local gradle
Upvotes: 0
Reputation: 75
This is how i fixed it.
Upvotes: -2
Reputation: 599
Ok, I don't know how I got this error, I completed my project and when I came back from a short break, I saw this error and I don't know how did I run into it.
But after searching an answer over stack overflow, I didn't get one
So just tried to launch another already completed project and it was also giving the same error
Then I just switch my internet connection from my wifi router to my mobile hotspot and try again and it worked
If you didn't find any answer yet just give this one a try, might this one solve your problem
Upvotes: 1
Reputation: 31
First, I shut down my proxy, but it doesn't work.
Then I just try again and again, and add the code below in build.gradle
repositories {
google()
jcenter()
mavenCentral()
}
Upvotes: 1
Reputation: 386
Go to File > Project Structure and then:
jcenter
to jcenter()
in the Android plugin Repository and Default Library RepositoryUpvotes: 26
Reputation: 3334
Update latest version of dependencies work for me in project level build.gradle!!!
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0-alpha05'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:4.0.1'
}
Upvotes: 0
Reputation: 1546
Sometimes this works for me, when there's a sudden gradle syncing problem which should work fine (or previously worked fine).
Build with local gradle distribution
Download a gradle release archive from here to path android-studio/gradle/ folder, and extract it.
In Android Studio: File > Settings > Build, Execution > Gradle.
Select 'Use local gradle distribution' under 'Project-level settings'.
In 'Grade home', browse to the path of the downloaded gradle and select it.
OK > Sync project.
P.S. if local gradle is already selected, try reverse i.e. default wrapper.
Upvotes: 0