In my project I use mapbox_gl: ^0.14.0
.
When running flutter build aar command it fails with:
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 task assembleAarDebug failed with exit code 1.
Also flutter doctor:
[✓] 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)
I think it's the problem with secret token since it gives me Unauthorized 401 from server.
I made sure that I put it in my global (not project) gradle.properties the secret key like this:
MAPBOX_DOWNLOADS_TOKEN=sk.eyJ1Ij...
I saw in another thread that maybe it should be MAPBOX_DOWNLOAD_TOKEN instead of MAPBOX_DOWNLOADS_TOKEN
but it did not help.
My secret token has all PUBLIC SCOPES ticked and DOWNLOADS:READ ticked in SECRET SCOPES
So maybe my project simply not reading it but I don't know why.