颤振 - 无法获取“https://google.bintray.com/exoplayer/com/google/android/gms/play-services-location/maven-m

Posted

技术标签:

【中文标题】颤振 - 无法获取“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 【发布时间】:2021-07-25 14:46:54 【问题描述】:

我有一个项目昨天运行良好,但是今天却出现了这个错误

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

我今天没有更改任何 Gradle 或清单,只是昨天的相同代码 我所做的是

    颤振清洁 使缓存无效/重启 Android Studio 更新 Flutter 版本和任何插件(目前我使用的是 2.06 稳定通道) 关注这个 GitHub 问题 (https://github.com/Baseflow/flutter-geolocator/issues/647) 但是我在升级 Gradle 版本时遇到了另一个错误,比如 manifest 没有找到
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

其他信息

颤振医生-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

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

#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

我正在使用这个最新版本的软件包 Geolocator

https://pub.dev/packages/geolocator

更新

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

【问题讨论】:

【参考方案1】:

对我来说,通过升级来解决我的问题

compileSdkVersion从 29 到 30

targetSdkVersion 从 29 到 30

gradle-wrapper.properties

我的分发网址是

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

【讨论】:

compileSdkVersiontargetSdkVersion 升级到已安装的 sdk 就可以了【参考方案2】:

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

以及 build.gradle 文件中依赖项中的以下类路径: classpath 'com.android.tools.build:gradle:4.1.0

查看 Flutter 2.0.5 Stable 通道,这些是正确的设置。这解决了我的问题。

【讨论】:

我之前做过这个并且得到了另一个错误(来自这个git链接,github.com/Baseflow/flutter-geolocator/issues/647)目前我正在将distributionurl更改为https\://services.gradle.org/distributions/gradle-6.0-all.zip并且它再次工作,我正在使用Flutter 2.0.6稳定渠道 @DonKey 如果您的答案解决了您的问题,请将其发布为答案并将其标记为解决方案。【参考方案3】:

我通过更新 gradle 的包装器和插件找到了另一个解决方案。

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

gradle-wrapper.properties

同时更新 root 级别 build.gradle 文件中的插件

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

【讨论】:

以上是关于颤振 - 无法获取“https://google.bintray.com/exoplayer/com/google/android/gms/play-services-location/maven-m的主要内容,如果未能解决你的问题,请参考以下文章

无法使用颤振在android中获取后台通知

颤振我无法从地理定位器获取地址

颤振无法从 api 获取数据,dio 错误

无法从 api 获取数据,Future 总是返回 null - 颤振

400 错误时无法获取数据。在颤振中

无法从函数中获取价值,即使我有一个非常相似的函数。 - 颤振