Flutter 无法解析 com.google.android.gms:play-services-location:16.+

Posted

技术标签:

【中文标题】Flutter 无法解析 com.google.android.gms:play-services-location:16.+【英文标题】:Flutter Could not resolve com.google.android.gms:play-services-location:16.+ 【发布时间】:2021-08-17 08:27:37 【问题描述】:

我有一个flutter项目,从昨天开始就出现这样的错误

Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
   > Could not resolve com.google.android.gms:play-services-location:16.+.
     Required by:
         project :app > project :location
      > Failed to list versions for com.google.android.gms:play-services-location.
         > Unable to load Maven meta-data from https://jcenter.bintray.com/com/google/android/gms/play-services-location/maven-metadata.xml.
            > Could not get resource 'https://jcenter.bintray.com/com/google/android/gms/play-services-location/maven-metadata.xml'.
               > Could not GET 'https://jcenter.bintray.com/com/google/android/gms/play-services-location/maven-metadata.xml'.
                  > Connect to jcenter.bintray.com:443 [jcenter.bintray.com/34.95.74.180] failed: Read timed out

不知道,新建项目的时候可以运行,但是添加位置库的时候,出现这样的错误。 这是我的 pubspec.yaml

dependencies:
  flutter:
    sdk: flutter
  shared_preferences: ^0.5.6+1
  http: ^0.12.0+4
  intl: ^0.16.1
  location: ^3.2.4

另外,这是我的颤振医生:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 1.22.5, on Microsoft Windows [Version 10.0.19042.985], locale en-ID)

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[√] Android Studio (version 3.5)
[√] VS Code (version 1.56.2)
[√] Connected device (1 available)

• No issues found!

【问题讨论】:

【参考方案1】:

我使用另一个互联网连接修复了它。以前我使用家庭 WiFi 连接,然后我尝试使用移动热点。

【讨论】:

使用***也可以解决这个问题

以上是关于Flutter 无法解析 com.google.android.gms:play-services-location:16.+的主要内容,如果未能解决你的问题,请参考以下文章

为啥 Flutter 构建失败并出现错误无法解析配置“:app:debugRuntimeClasspath”的所有文件

错误:无法在 Flutter 中解析包名称

升级flutter后创建方法通道-无法解析方法getFlutterView()

Flutter DistanceMatrix JSON 无法正确解析

Flutter 无法解析 com.google.android.gms:play-services-location:16.+

无法解析 Flutter 应用程序的 android/app/build.gradle 文件中的符号 GradleException