无法解析配置的所有文件“:app:调试器运行时Could”。
com.mapbox.navigator:mapbox-navigation-native:7.0.0.
无法解析要求: project :app > com.mapbox.mapboxsdk:mapbox-android-navigation-ui:0.42.6 > com.mapbox.mapboxsdk:mapbox-android-navigation:0.42.6 >无法解析com.mapbox.navigator:mapbox-navigation-native:7.0.0.>无法获得资源的https://mapbox.bintray.com/mapbox/com/mapbox/navigator/mapbox-navigation-native/7.0.0/mapbox-navigation-native-7.0.0.pom'。>不能得到'https://mapbox.bintray.com/mapbox/com/mapbox/navigator/mapbox-navigation-native/7.0.0/mapbox-navigation-native-7.0.0.pom'‘。从服务器接收状态代码403 :禁忌>无法解析com.mapbox.navigator:mapbox-navigation-native:7.0.0.>无法获得资源的https://api.mapbox.com/downloads/v2/releases/maven/com/mapbox/navigator/mapbox-navigation-native/7.0.0/mapbox-navigation-native-7.0.0.pom'。>不能得到'https://api.mapbox.com/downloads/v2/releases/maven/com/mapbox/navigator/mapbox-navigation-native/7.0.0/mapbox-navigation-native-7.0.0.pom'‘。从服务器接收状态代码403 :禁用
发布于 2021-09-13 17:40:02
问题:
您没有下载mapbox依赖项的访问权限,这需要从mapbox帐户中获得一个有效的令牌。
解决方案:
首先,您需要一个带有下载优先级的mapbox访问令牌:转到https://account.mapbox.com/access-tokens/create并使用Downloads:READ
创建一个访问令牌
您需要在项目级别级别上指定mapbox令牌,将您的标记添加到gradle.properties中
android.useAndroidX=true
android.enableJetifier=true
MAPBOX_DOWNLOADS_TOKEN=yourMapBoxKey
请注意,您需要启用下载:读取令牌上的作用域,如果没有,那么在构建项目时将得到403:禁忌
在你的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"
}
}
希望这能帮助解决问题。
参考文献:https://githubmemory.com/repo/eopeter/flutter_mapbox_navigation/issues/126
发布于 2022-01-06 18:12:26
基于@Moulaye的回答,对我来说,我只在构建脚本存储库中将新的存储库URL添加到maven中,但它不起作用,即使有适当的标记,我仍然得到了401次未经授权的错误。我所做的也是将身份验证添加到我的Allprojects存储库中,比如在提到maven存储库的地方添加身份验证:
// 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'] ?: ""
}
}
}
}
两次。因为一些奇怪的原因可能会遇到类似的问题。确保使用选中的DOWNLOADS:READ
选项从mapbox生成一个新的下载令牌。
https://stackoverflow.com/questions/69142806
复制相似问题