1

在我的项目中,我使用mapbox_gl: ^0.14.0.

运行 flutter build aar 命令时失败:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':mapbox_gl:generateDebugRFile'.
> Could not resolve all files for configuration ':mapbox_gl:debugCompileClasspath'.
   > Could not resolve com.mapbox.mapboxsdk:mapbox-android-sdk:9.6.2.
     Required by:
         project :mapbox_gl
      > Could not resolve com.mapbox.mapboxsdk:mapbox-android-sdk:9.6.2.
         > Could not get resource 'https://api.mapbox.com/downloads/v2/releases/maven/com/mapbox/mapboxsdk/mapbox-android-sdk/9.6.2/mapbox-android-sdk-9.6.2.pom'.
            > Could not HEAD 'https://api.mapbox.com/downloads/v2/releases/maven/com/mapbox/mapboxsdk/mapbox-android-sdk/9.6.2/mapbox-android-sdk-9.6.2.pom'. Received status code 401 from server: Unauthorized
   > Could not resolve com.mapbox.mapboxsdk:mapbox-android-sdk:9.6.2.
     Required by:
         project :mapbox_gl > com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v9:0.9.0
      > Could not resolve com.mapbox.mapboxsdk:mapbox-android-sdk:9.6.2.
         > Could not get resource 'https://api.mapbox.com/downloads/v2/releases/maven/com/mapbox/mapboxsdk/mapbox-android-sdk/9.6.2/mapbox-android-sdk-9.6.2.pom'.
            > Could not HEAD 'https://api.mapbox.com/downloads/v2/releases/maven/com/mapbox/mapboxsdk/mapbox-android-sdk/9.6.2/mapbox-android-sdk-9.6.2.pom'. Received status code 401 from server: Unauthorized
   > Could not resolve com.mapbox.mapboxsdk:mapbox-android-sdk:9.6.2.
     Required by:
         project :mapbox_gl > com.mapbox.mapboxsdk:mapbox-android-plugin-localization-v9:0.12.0
         project :mapbox_gl > com.mapbox.mapboxsdk:mapbox-android-plugin-offline-v9:0.7.0
      > Could not resolve com.mapbox.mapboxsdk:mapbox-android-sdk:9.6.2.
         > Could not get resource 'https://api.mapbox.com/downloads/v2/releases/maven/com/mapbox/mapboxsdk/mapbox-android-sdk/9.6.2/mapbox-android-sdk-9.6.2.pom'.
            > Could not HEAD 'https://api.mapbox.com/downloads/v2/releases/maven/com/mapbox/mapboxsdk/mapbox-android-sdk/9.6.2/mapbox-android-sdk-9.6.2.pom'. Received status code 401 from server: Unauthorized

* 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 30s

Gradle 任务 assembleAarDebug 失败,退出代码为 1。

还扑医生:

[✓] Flutter (Channel stable, 2.8.0, on macOS 12.0.1 21A559 darwin-x64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] VS Code (version 1.63.2)
[✓] Connected device (2 available)

我认为这是秘密令牌的问题,因为它给了我来自服务器的未经授权的 401。

我确保将它放在我的全局(不是项目)gradle.properties 中的密钥是这样的: MAPBOX_DOWNLOADS_TOKEN=sk.eyJ1Ij... 我在另一个线程中看到它可能应该是 MAPBOX_DOWNLOAD_TOKEN 而不是 MAPBOX_DOWNLOADS_TOKEN 但它没有帮助。

我的秘密令牌在秘密范围中勾选了所有 PUBLIC SCOPES 和 DOWNLOADS:READ

所以也许我的项目根本没有阅读它,但我不知道为什么。

4

0 回答 0