当我试图在Android中使用mapbox时,我面临着这个问题。
解决失败:com.mapbox.mapboxsdk:mapbox:9.5.0
有什么问题吗?
我的build.gradle依赖关系
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:9.5.0'
}
我的build.gradle项目
buildscript {
repositories {
google()
mavenCentral()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.1"
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://mapbox.bintray.com/mapbox' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
发布于 2020-11-08 21:24:52
试试看这个版本如何,实际上是存在
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:8.6.7'
发布于 2021-02-05 20:12:25
只是解释得很糟糕。你得做个私人的记号。公共令牌不起作用。创建令牌时,有一个"Read:Download“字段,只需标记它并生成令牌。这个标记应该有效。
发布于 2020-11-09 11:38:48
版本9.5.0 (和9.6.0)也存在(参见这里的发行说明:https://github.com/mapbox/mapbox-gl-native-android/blob/main/CHANGELOG.md)。只是Mapbox > v9.4.0改变了访问Maven存储库的方式。
我会劝阻您不要使用像mapbox-android-sdk:8.6.7
这样的过时版本,但是请使用com.mapbox.mapboxsdk:mapbox-android-sdk:9.6.0
。
访问mave的新方法记录在这里:https://docs.mapbox.com/android/maps/overview/#configure-credentials
现在您需要创建一个秘密访问令牌,并使用它访问库所在的maven repo。模块级别的build.gradle应该包含以下内容:
allprojects {
repositories {
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'] ?: ""
}
}
}
}
https://stackoverflow.com/questions/64738753
复制相似问题