Reputation: 23
Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not resolve com.mapbox.navigator:mapbox-navigation-native:7.0.0. Required by: project :app > com.mapbox.mapboxsdk:mapbox-android-navigation-ui:0.42.6 > com.mapbox.mapboxsdk:mapbox-android-navigation:0.42.6 > Could not resolve com.mapbox.navigator:mapbox-navigation-native:7.0.0. > Could not get resource 'https://mapbox.bintray.com/mapbox/com/mapbox/navigator/mapbox-navigation-native/7.0.0/mapbox-navigation-native-7.0.0.pom'. > Could not GET 'https://mapbox.bintray.com/mapbox/com/mapbox/navigator/mapbox-navigation-native/7.0.0/mapbox-navigation-native-7.0.0.pom'. Received status code 403 from server: Forbidden > Could not resolve com.mapbox.navigator:mapbox-navigation-native:7.0.0. > Could not get resource 'https://api.mapbox.com/downloads/v2/releases/maven/com/mapbox/navigator/mapbox-navigation-native/7.0.0/mapbox-navigation-native-7.0.0.pom'. > Could not GET 'https://api.mapbox.com/downloads/v2/releases/maven/com/mapbox/navigator/mapbox-navigation-native/7.0.0/mapbox-navigation-native-7.0.0.pom'. Received status code 403 from server: Forbidden
Upvotes: 1
Views: 3792
Reputation: 1
I created New Token with Download:read permission at https://console.mapbox.com/account/access-tokens.
Add new genereted secret key to app.json 0r app.config.js -> "plugins": [ [ "@rnmapbox/maps", { "MAPBOX_TOKEN" } ] ]
add MAPBOX_DOWNLOADS_TOKEN to gradle.properties -> MAPBOX_DOWNLOADS_TOKEN= MAPBOX_TOKEN
add mapbox authentication to build.gradle->Allprojects -> repositories:
Upvotes: 0
Reputation: 145
Building on @Moulaye 's answer, for me, I added the new repository URL to maven in my buildscript repositories only, and it didnot work, I was still gettting a 401 unauthorized error even with a proper token. What I did was also add authentication to my Allprojects repositories as well, like adding authentication whereever the maven repository has been mentioned. like this:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
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.2"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
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'] ?: ""
}
}
}
}
Twice. For anyone that might meet a similar problem for some strange reason. Make sure you generate a new download token from mapbox with a the DOWNLOADS:READ
option checked.
Upvotes: 0
Reputation: 1292
The problem:
you don't have access rights to download mapbox dependencies which need a valid token from your mapbox account.
Solution:
First you need to have a mapbox access token with Downloads privieleges:
Go to https://account.mapbox.com/access-tokens/create and create an access token with Downloads:READ
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.
refs: https://githubmemory.com/repo/eopeter/flutter_mapbox_navigation/issues/126
Upvotes: 4