网络正常的情况下,AndroidStudio为什么不能下载Google URL的文件!

昨天发生IOException的错,但我用浏览器是可以访问与打开的,用的是路由器上的Google(不需要设Proxy),
但在Terminal里出现下面的错误。诡异之处在于,Terminal的提示,你得在AndroidStudio解决!
第二个问题的诡异之处在于,Terminal与AndroidStudio都能正常访问Google,可以更新下载,仍还提示IOException错误

记之备查

JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...

> Configure project :app
IOException: https://dl.google.com/android/repository/addons_list-3.xml
java.net.ConnectException: Connection refused
IOException: https://dl.google.com/android/repository/addons_list-2.xml
java.net.ConnectException: Connection refused
IOException: https://dl.google.com/android/repository/addons_list-1.xml
java.net.ConnectException: Connection refused
Failed to download any source lists!
java.net.ConnectException: Connection refused


FAILURE: Build failed with an exception.

第二种情况,环境变量PATH的SDK指向的还是去年用cocos2d-lua时的SDK,与AndroidStudio的不一致,将〜/.bash_profile修改,重新创建flutter app问题解释。

export ANDROID_SDK_ROOT="/Users/wenewzhang/Library/Android/sdk/tools"
export ANDROID_HOME="/Users/wenewzhang/Library/Android/sdk"

冗长的错误提示如下:从xml解释可以看出,最新下载的addon.xml没有找到需要的数据项。

wenewzha:android wenewzhang$ ./gradlew app:properties
Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details

> Configure project :app
IOException: https://dl.google.com/android/repository/addons_list-3.xml
java.net.ConnectException: Connection refused
Failed to fetch URL https://dl.google.com/android/repository/addon.xml, reason: Connect Connection refused
Failed to fetch URL
Errors during XML parse:
cvc-elt.1: Cannot find the declaration of element 'sdk:sdk-addon'.
org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 129; cvc-elt.1: Cannot find the declaration of element 'sdk:sdk-addon'.
javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 129; cvc-elt.1: Cannot find the declaration of element 'sdk:sdk-addon'.]
Additionally, the fallback loader failed to parse the XML.
Failed to fetch URL https://dl.google.com/android/repository/glass/addon.xml, reason: Connect Connection refused
Failed to fetch URL
Errors during XML parse:
cvc-elt.1: Cannot find the declaration of element 'sdk:sdk-addon'.
org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 129; cvc-elt.1: Cannot find the declaration of element 'sdk:sdk-addon'.
javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 129; cvc-elt.1: Cannot find the declaration of element 'sdk:sdk-addon'.]
Additionally, the fallback loader failed to parse the XML.
Failed to fetch URL https://dl.google.com/android/repository/extras/intel/addon.xml, reason: Connect Connection refused
Failed to fetch URL
Errors during XML parse:
cvc-elt.1: Cannot find the declaration of element 'sdk:sdk-addon'.
org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 129; cvc-elt.1: Cannot find the declaration of element 'sdk:sdk-addon'.
javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 129; cvc-elt.1: Cannot find the declaration of element 'sdk:sdk-addon'.]
Additionally, the fallback loader failed to parse the XML.
Failed to fetch URL https://dl.google.com/android/repository/sys-img/android/sys-img.xml, reason: Connect Connection refused
Failed to fetch URL
Errors during XML parse:
cvc-elt.1: Cannot find the declaration of element 'sdk:sdk-sys-img'.
org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 133; cvc-elt.1: Cannot find the declaration of element 'sdk:sdk-sys-img'.
javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 133; cvc-elt.1: Cannot find the declaration of element 'sdk:sdk-sys-img'.]
Additionally, the fallback loader failed to parse the XML.
Failed to fetch URL https://dl.google.com/android/repository/sys-img/android-wear/sys-img.xml, reason: Connect Connection refused
Failed to fetch URL
Errors during XML parse:
cvc-elt.1: Cannot find the declaration of element 'sdk:sdk-sys-img'.
org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 133; cvc-elt.1: Cannot find the declaration of element 'sdk:sdk-sys-img'.
javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 133; cvc-elt.1: Cannot find the declaration of element 'sdk:sdk-sys-img'.]
Additionally, the fallback loader failed to parse the XML.
Failed to fetch URL https://dl.google.com/android/repository/sys-img/android-tv/sys-img.xml, reason: Connect Connection refused
Failed to fetch URL
Errors during XML parse:
cvc-elt.1: Cannot find the declaration of element 'sdk:sdk-sys-img'.
org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 133; cvc-elt.1: Cannot find the declaration of element 'sdk:sdk-sys-img'.
javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 133; cvc-elt.1: Cannot find the declaration of element 'sdk:sdk-sys-img'.]
Additionally, the fallback loader failed to parse the XML.
Failed to fetch URL https://dl.google.com/android/repository/sys-img/google_apis/sys-img.xml, reason: Connect Connection refused
Failed to fetch URL
Errors during XML parse:
cvc-elt.1: Cannot find the declaration of element 'sdk:sdk-sys-img'.
org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 133; cvc-elt.1: Cannot find the declaration of element 'sdk:sdk-sys-img'.
javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 133; cvc-elt.1: Cannot find the declaration of element 'sdk:sdk-sys-img'.]
Additionally, the fallback loader failed to parse the XML.
Failed to fetch URL https://dl.google.com/android/repository/sys-img/google_apis_playstore/sys-img.xml, reason: Connect Connection refused
Failed to fetch URL
Errors during XML parse:
cvc-elt.1: Cannot find the declaration of element 'sdk:sdk-sys-img'.
org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 133; cvc-elt.1: Cannot find the declaration of element 'sdk:sdk-sys-img'.
javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 133; cvc-elt.1: Cannot find the declaration of element 'sdk:sdk-sys-img'.]
Additionally, the fallback loader failed to parse the XML.
java.net.ConnectException: Connection refused

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/wenewzhang/Documents/sl/tmp/flutter_app/flutter_app/android/build.gradle' line: 24

* What went wrong:
A problem occurred evaluating root project 'android'.
> A problem occurred configuring project ':app'.
   > Failed to find Build Tools revision 28.0.3

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org
export PATH="/opt/local/lib/mysql57/bin:/opt/local/bin:/opt/local/sbin:$PATH"

BUILD FAILED in 12s

androidstudio-sdk-path