无法解析mapbox-android-sdk

发布于 2025-01-13 05:58:12 字数 2533 浏览 0 评论 0原文

我正在尝试添加最新版本的地图框,但失败了。 我已经关注了

gradle.properties< 中的 MapBox 文档 秘密令牌/strong> 文件:

MAPBOX_DOWNLOADS_TOKEN=MY_SECRET_MAPBOX_ACCESS_TOKEN_IN_PAIN_TEXT_WITHOUT_QUOTES

下载令牌是从具有 DOWNLOAD:READ 权限的 MapBox 站点生成的,正如他们在文档中提到的那样,它以 sk 开头。

MAPBOX_DOWNLOADS_TOKEN=sk.sdjshdjshdj.....etc

我的 settings.gradle 文件。

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
    repositories {
        google()
        mavenCentral()
        jcenter() // Warning: this repository is going to shut down soon
        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
            }
        }
        maven { url "https://maven.google.com" }
        maven { url 'https://jitpack.io' }
   }
}

同步 Gradle 文件后的应用程序级别 gradle 文件

dependencies {
  //OTHER DEPENDENCIES....
  implementation 'com.mapbox.maps:android:10.3.0'
}

Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com.mapbox.mapboxsdk:mapbox-android-sdk:10.3.0.
Show Details
Affected Modules: app

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.mapbox.mapboxsdk:mapbox-android-sdk:10.3.0.
Show Details
Affected Modules: app

Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.mapbox.mapboxsdk:mapbox-android-sdk:10.3.0.
Show Details
Affected Modules: app

我已经检查了下面的答案,但不起作用。

  1. 如何解决:无法解析:com.mapbox.mapboxsdk:mapbox-android-sdk:9.5.0
  2. 为什么mapbox-android sdk无法从build.gradle解析?< /a>

我不知道出了什么问题。 提前致谢。

I am trying to add latest version of Map box, but its failing.
I have followed MapBox Documentation

secret token in gradle.properties file:

MAPBOX_DOWNLOADS_TOKEN=MY_SECRET_MAPBOX_ACCESS_TOKEN_IN_PAIN_TEXT_WITHOUT_QUOTES

Download Token is generated from MapBox site with DOWNLOAD:READ permission, as they mentioned in the documentation and it was starting with sk.

MAPBOX_DOWNLOADS_TOKEN=sk.sdjshdjshdj.....etc

My settings.gradle File.

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
    repositories {
        google()
        mavenCentral()
        jcenter() // Warning: this repository is going to shut down soon
        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
            }
        }
        maven { url "https://maven.google.com" }
        maven { url 'https://jitpack.io' }
   }
}

app level gradle file

dependencies {
  //OTHER DEPENDENCIES....
  implementation 'com.mapbox.maps:android:10.3.0'
}

After Syncing Gradle Files.

Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com.mapbox.mapboxsdk:mapbox-android-sdk:10.3.0.
Show Details
Affected Modules: app

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.mapbox.mapboxsdk:mapbox-android-sdk:10.3.0.
Show Details
Affected Modules: app

Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.mapbox.mapboxsdk:mapbox-android-sdk:10.3.0.
Show Details
Affected Modules: app

I have checked below answers, but not working.

  1. How to solve : Failed to resolve: com.mapbox.mapboxsdk:mapbox-android-sdk:9.5.0
  2. Why is mapbox-android sdk not resolving from build.gradle?

I don't know what's wrong.
Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

葬花如无物 2025-01-20 05:58:12

我为此苦苦挣扎了两天。版本 9.2.6 使用相同的文档。另请确保将 settings.gradle 更改为 PREFER_SETTINGS。将 maven {url 'https://mapbox.bintray.com/mapbox' } 添加到 mavencentral 下的项目级别 gradle 中。您的 MAPBOX_DOWNLOADS_TOKEN 将以“sk”而不是“pk”开头。下载私钥时,请检查下载:阅读

I was struggling with this for two days. Version 9.2.6 works with the same documentation. Also make sure you change your settings.gradle to PREFER_SETTINGS. Add maven {url 'https://mapbox.bintray.com/mapbox' } to your project level gradle under maven central. your MAPBOX_DOWNLOADS_TOKEN will start with "sk" instead of "pk". When downloading your private key, check the DOWNLOADS:READ

意中人 2025-01-20 05:58:12

这是我的 build.gradle 项目级别的样子:

allprojects {
repositories {
    google()
    mavenCentral()
    maven {
        url 'https://api.mapbox.com/downloads/v2/releases/maven'
    }
}
}

build.gradle 应用程序级别:

 implementation('com.mapbox.maps:android:10.3.0')

我正在为视图提供令牌:

  <com.mapbox.maps.MapView xmlns:mapbox="http://schemas.android.com/apk/res-auto"
            android:id="@+id/mapView"
            android:layout_width="0dp"
            android:layout_height="0dp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            mapbox:mapbox_resourcesAccessToken="@string/map_box_access_token" />

Here is how my build.gradle project level looks like:

allprojects {
repositories {
    google()
    mavenCentral()
    maven {
        url 'https://api.mapbox.com/downloads/v2/releases/maven'
    }
}
}

build.gradle app level:

 implementation('com.mapbox.maps:android:10.3.0')

And I am providing the view with the token:

  <com.mapbox.maps.MapView xmlns:mapbox="http://schemas.android.com/apk/res-auto"
            android:id="@+id/mapView"
            android:layout_width="0dp"
            android:layout_height="0dp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            mapbox:mapbox_resourcesAccessToken="@string/map_box_access_token" />
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文