简体   繁体   English

Flutter - 无法获取“https://google.bintray.com/exoplayer/com/google/android/gms/play-services-location/maven-metadata.xml”。 收到状态码403

[英]Flutter - Could not GET 'https://google.bintray.com/exoplayer/com/google/android/gms/play-services-location/maven-metadata.xml'. Receivedstatuscode403

I have a project which running well yesterday, but today, I got this error我有一个昨天运行良好的项目,但是今天,我收到了这个错误

FAILURE: Build failed with an exception.

* What went wrong:
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://google.bintray.com/exoplayer/com/google/android/gms/play-services-location/maven-metadata.xml.
            > Could not get resource 'https://google.bintray.com/exoplayer/com/google/android/gms/play-services-location/maven-metadata.xml'.
               > Could not GET 'https://google.bintray.com/exoplayer/com/google/android/gms/play-services-location/maven-metadata.xml'. Received status code 403 from server: Forbidden

* 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

BUILD FAILED in 17s
Exception: Gradle task assembleDebug failed with exit code 1

I am not changed any Gradle or manifest today, just the same code from yesterday What I have been done is我今天没有更改任何 Gradle 或清单,只是昨天的相同代码我所做的是

  1. Flutter Clean Flutter 清洁
  2. Invalidate Caches / Restart Android Studio使缓存无效/重新启动 Android Studio
  3. Update Flutter Version and any Plugin (Currently I am using 2.06 Stable Channel)更新 Flutter 版本和任何插件(目前我使用的是 2.06 稳定通道)
  4. Follow This GitHub issue ( https://github.com/Baseflow/flutter-geolocator/issues/647 ) but I got another error while upgrade the Gradle version, something like manifest doesn't found关注此 GitHub 问题( https://github.com/Baseflow/flutter-geolocator/issues/647 )但我在升级 Gradle 版本时遇到了另一个错误,
{{HOME}}\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\permission_handler-7.1.0\android\src\main\java\com\baseflow\permissionhandler\PermissionManager.java:53: error: cannot find symbol
            status = Environment.isExternalStorageManager()
                                ^
  symbol:   method isExternalStorageManager()
  location: class Environment
{{HOME}}\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\permission_handler-7.1.0\android\src\main\java\com\baseflow\permissionhandler\PermissionManager.java:222: error: cannot find symbol
                    if (permission == PermissionConstants.PERMISSION_GROUP_MANAGE_EXTERNAL_STORAGE && Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
                                                                                          ^
  symbol:   variable R
  location: class VERSION_CODES
{{HOME}}\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\permission_handler-7.1.0\android\src\main\java\com\baseflow\permissionhandler\PermissionManager.java:236: error: cannot find symbol
            } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && permission == PermissionConstants.PERMISSION_GROUP_MANAGE_EXTERNAL_STORAGE) {
                                                                   ^
  symbol:   variable R
  location: class VERSION_CODES
{{HOME}}\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\permission_handler-7.1.0\android\src\main\java\com\baseflow\permissionhandler\PermissionManager.java:238: error: cannot find symbol
                        Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION,
                                ^
  symbol:   variable ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION
  location: class Settings
{{HOME}}\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\permission_handler-7.1.0\android\src\main\java\com\baseflow\permissionhandler\PermissionManager.java:300: error: cannot find symbol
                if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
                                                               ^
  symbol:   variable R
  location: class VERSION_CODES
{{HOME}}\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\permission_handler-7.1.0\android\src\main\java\com\baseflow\permissionhandler\PermissionManager.java:329: error: cannot find symbol
                    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
                                                                   ^
  symbol:   variable R
  location: class VERSION_CODES
{{HOME}}\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\permission_handler-7.1.0\android\src\main\java\com\baseflow\permissionhandler\PermissionManager.java:333: error: cannot find symbol
                    return Environment.isExternalStorageManager()
                                      ^
  symbol:   method isExternalStorageManager()
  location: class Environment
{{HOME}}\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\permission_handler-7.1.0\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:64: error: cannot find symbol
            case Manifest.permission.MANAGE_EXTERNAL_STORAGE:
                                    ^
  symbol:   variable MANAGE_EXTERNAL_STORAGE
  location: class permission
{{HOME}}\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\permission_handler-7.1.0\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:225: error: cannot find symbol
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && hasPermissionInManifest(context, permissionNames, Manifest.permission.MANAGE_EXTERNAL_STORAGE ))
                                                                ^
  symbol:   variable R
  location: class VERSION_CODES
{{HOME}}\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\permission_handler-7.1.0\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:225: error: cannot find symbol
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && hasPermissionInManifest(context, permissionNames, Manifest.permission.MANAGE_EXTERNAL_STORAGE ))
                                                                                          ^
  symbol:   variable MANAGE_EXTERNAL_STORAGE
  location: class permission
{{HOME}}\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\permission_handler-7.1.0\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:226: error: cannot find symbol
                    permissionNames.add(Manifest.permission.MANAGE_EXTERNAL_STORAGE);
                                                           ^
  symbol:   variable MANAGE_EXTERNAL_STORAGE
  location: class permission
11 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':permission_handler:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* 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

BUILD FAILED in 1m 28s
Exception: Gradle task assembleDebug failed with exit code 1

Additional Information附加信息

Flutter Doctor -v Flutter 博士-v

[√] Flutter (Channel stable, 2.0.6, on Microsoft Windows [Version 10.0.19042.746], locale en-US)
    • Flutter version 2.0.6 at D:\SDK\FlutterSDK\flutter
    • Framework revision 1d9032c7e1 (3 days ago), 2021-04-29 17:37:58 -0700
    • Engine revision 05e680e202
    • Dart version 2.12.3

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at D:\SDK\AndroidSDK
    • Platform android-30, build-tools 30.0.3
    • ANDROID_SDK_ROOT = D:\SDK\AndroidSDK
    • 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)
    • All Android licenses accepted.

[X] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[√] Android Studio (version 4.1.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] IntelliJ IDEA Ultimate Edition (version 2019.2)
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA 2019.2
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart

[√] Connected device (2 available)
    • Android SDK built for x86 64 (mobile) • emulator-5554 • android-x64    • Android 8.0.0 (API 26) (emulator)
    • Edge (web)                            • edge          • web-javascript • Microsoft Edge 90.0.818.51

android/build.gradle安卓/build.gradle

buildscript {
    ext.kotlin_version = '1.3.50'
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Gradle-Wrapper-Properties Gradle-Wrapper-Properties

#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip

I'm using this latest version package Geolocator我正在使用这个最新版本的 package 地理定位器

https://pub.dev/packages/geolocator

Update更新

Change the distribution URL into 
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0-all.zip
Fix my problem 

For me fix my problem by upgrading对我来说,通过升级来解决我的问题

compileSdkVersion from 29 to 30 compileSdkVersion从 29 到 30

targetSdkVersion from 29 to 30 targetSdkVersion从 29 到 30

gradle-wrapper.properties gradle-wrapper.properties

and my distribution URL is我的分布 URL 是

distributionUrl=https://services.gradle.org/distributions/gradle-6.5-bin.zip distributionUrl=https://services.gradle.org/distributions/gradle-6.5-bin.zip

Try using the following distributionUrl in your gradle-wrapper.properties: distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip尝试在 gradle-wrapper.properties 中使用以下 distributionUrl: distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip

And the following classpath in dependencies in your build.gradle file: classpath 'com.android.tools.build:gradle:4.1.0以及 build.gradle 文件中依赖项中的以下类路径: classpath 'com.android.tools.build:gradle:4.1.0

Looking at the Flutter 2.0.5 Stable channel, these are the right settings.查看Flutter 2.0.5稳定通道,这些是正确的设置。 This fixed the problem for me.这解决了我的问题。

I found another solution for this by updating the wrapper and plugin for gradle.我通过更新 gradle 的包装器和插件找到了另一个解决方案。

distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip

in gradle-wrapper.propertiesgradle-wrapper.properties

also update the plugin in root level build.gradle file还更新rootbuild.gradle文件中的插件

classpath 'com.android.tools.build:gradle:4.1.0'

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法获取“https://jitpack.io/com/google/android/gms/play-services-basement/maven-metadata.xml”。 从服务器收到状态码 403:Forbidden - Could not GET 'https://jitpack.io/com/google/android/gms/play-services-basement/maven-metadata.xml'. Received status code 403 from server: Forbidden 无法获取“google.bintray.com/exoplayer/com/transistorsoft/tsbackgroundfetch/maven-metadata.xml”。从服务器接收到状态代码 502:网关错误 - Could not GET 'google.bintray.com/exoplayer/com/transistorsoft/tsbackgroundfetch/maven-metadata.xml'.Received status code 502 from server:Bad Gateway Flutter 错误:无法解析 com.google.android.gms:play-services-location:16.+,状态码 502 - Flutter error : Could not resolve com.google.android.gms:play-services-location:16.+, Status code 502 flutter android - 无法列出 com.google.android.gms:play-services-location 的版本 - flutter android - Failed to list versions for com.google.android.gms:play-services-location Gradle同步失败:找不到com.google.android.gms:play-services-location:11.6.99 - Gradle sync failed: Could not find com.google.android.gms:play-services-location:11.6.99 无法解决依赖 com.google.android.gms:play-services-location:16.0.0 - could not to resolve the dependency com.google.android.gms:play-services-location:16.0.0 “ com.google.android.gms:play-services-location”和“ com.google.android.gms:play-services”之间的区别 - Difference between “com.google.android.gms:play-services-location” and “com.google.android.gms:play-services” 无法获取“https://google.bintray.com/flexbox-layout/com/google/android/flexbox/1.0.0/flexbox-1.0.0.pom” - Could not GET 'https://google.bintray.com/flexbox-layout/com/google/android/flexbox/1.0.0/flexbox-1.0.0.pom' 无法获取“play-services-location/maven-metadata.xml”。 从服务器收到状态码 502:Bad Gateway - Could not GET 'play-services-location/maven-metadata.xml'. Received status code 502 from server: Bad Gateway 错误:无法解析:com.google.android.gms:play-services-location:16.1.0 - ERROR: Failed to resolve: com.google.android.gms:play-services-location:16.1.0
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM