在运行我的第一个应用程序时 这是当我尝试运行某个应用程序甚至是Flutter随附的默认应用程序时收到的错误消息。
Exception in thread "main" java.net.UnknownHostException: services.gradle.org
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:673)
at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173)
at sun.net.NetworkClient.doConnect(NetworkClient
Exception: Gradle task assemblebug failed with Exit code 1
我尝试过的事情:
使缓存无效/重启
尝试连接真实设备而不是仿真器。出现了更多错误。
将compilesdkversion从28 -29更改为(在build.gradle下),也将目标从28-29转换为
确认(gradle-wrapper.properties)下的distributionurl为https = // services.gradle.org/distributions/gradle-5.6.2-all.zip
下面的扑打医生结果。
C:\Users\TOPE>flutter doctor -v
[√] Flutter (Channel stable, v1.17.5, on Microsoft Windows [Version 10.0.17134.1], locale en-US)
• Flutter version 1.17.5 at C:\Users\TOPE\FLUTTER\flutter
• Framework revision 8af6b2f038 (7 days ago), 2020-06-30 12:53:55 -0700
• Engine revision ee76268252
• Dart version 2.8.4
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
• Android SDK at C:\Users\TOPE\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.0
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] Android Studio (version 4.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 47.1.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] Connected device (1 available)
• AOSP on IA Emulator • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)
! Doctor found issues in 1 category.