我正在用java开发一个android应用程序,我想集成Mapbox,我遵循了这里的所有文档: https://docs.mapbox.com/android/maps/guides/install/
我成功请求了两个令牌,并在 build.gradle 中添加了依赖项。
dependencies {
implementation ("com.mapbox.maps:android:10.1.0")
}
问题是当我将以下代码粘贴到settings.gradle中时:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
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 = MAPBOX_DOWNLOADS_TOKEN
}
}
}
}
url 和 basic 无法识别,我收到几个错误,特别是:
意外的标记(使用“;”分隔同一行上的表达式)
未解决的参考:基本
如何解决安装过程中的这个问题?
语法应该如下所示
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven {
url = uri("https://api.mapbox.com/downloads/v2/releases/maven")
authentication {
create<BasicAuthentication>("basic")
}
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 = MAPBOX_DOWNLOADS_TOKEN
}
}
}
}