这个问题没有能直接解决…
解决方案:
app/build.gradle 原代码:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
...
}
}
allprojects {
repositories {
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
第一步:更改 url
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
maven {
url 'https://dl.google.com/dl/android/maven2'
name 'Google'
}
}
dependencies {
...
}
}
allprojects {
repositories {
maven {
url 'https://dl.google.com/dl/android/maven2'
name 'Google'
}
}
}
第二部,更改 hosts 文件 (Ubuntu 系统文件路径:/etc/hosts)
sudo gedit /etc/hosts
写入:203.208.40.36 dl.google.com
写入后的 hosts 文件:
重新编译,搞定!!!
附上参考博客:AndroidStudio编译时Unknown host ‘dl.google.com’. You may need to adjust the proxy settings