Flutter 2 flutter_mapbox_navigation package is not working
I'm using latest flutter sdk. I tried to use flutter_mapbox_navigation package in my project and I got the following error:
**FAILURE: Build failed with an exception.
- What went wrong: Could not determine the dependencies of task ':app:lintVitalRelease'.
Could not resolve all artifacts for configuration ':app:debugRuntimeClasspath'. Could not resolve com.mapbox.navigation:ui:1.2.0. Required by: project :app > project :flutter_mapbox_navigation > Could not resolve com.mapbox.navigation:ui:1.2.0. > Could not get resource 'https://api.mapbox.com/downloads/v2/releases/maven/com/mapbox/navigation/ui/1.2.0/ui-1.2.0.pom'. > Could not GET 'https://api.mapbox.com/downloads/v2/releases/maven/com/mapbox/navigation/ui/1.2.0/ui-1.2.0.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 18s**
I tried to istall the package in flutter 1 , but I can create a build with no hassle.
same as me even i used perfectly 1year ago.
I have the same problem
on my case, you need to specify the mapbox token on project level gradle, add your token to gradle.properties
android.useAndroidX=true
android.enableJetifier=true
MAPBOX_DOWNLOADS_TOKEN=yourMapBoxKey
take note that you need to enable Downloads:Read scope on your token, if not then you'll get 403: forbidden when build your project
and on your build.gradle
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
maven {
url 'https://api.mapbox.com/downloads/v2/releases/maven'
authentication {
basic(BasicAuthentication)
}
credentials {
// Do not change the username below.
// This should always be `mapbox` (not your username).
username = 'mapbox'
// Use the secret token you stored in gradle.properties as the password
password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
}
}
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
hope this can help solve the problem.
I think this package do not uploaded you can use other packages on pubdev or you can catch what package what are doing
Make sure to select downloads: read in secret scope when generating the token!
Received status code 401 from server: Unauthorized means access token was not delivered successfully
To download the MapBox SDK, your computer needs to pass access token to their server.
Make sure to create .netrc file in your home directory of your computer, not project.
And then add piece of code which is on readme file.
I am using MacOS and my home directory is something like users/NAME_YOU_GAVE
on Windows, it could be different
Getting same problem Could not resolve com.mapbox.navigation:ui-app:2.10.1.