【问题标题】:Android Studio can't cant find library dependency 'com.mapbox.mapboxsdk:mapbox-android-sdk:9.7.0'Android Studio 找不到库依赖 'com.mapbox.mapboxsdk:mapbox-android-sdk:9.7.0'
【发布时间】:2021-12-04 03:22:42
【问题描述】:

由于某种原因,当我的 android studio 找不到这个 SDK 时,这里是构建日志:

Failed to resolve: com.mapbox.mapboxsdk:mapbox-android-sdk:9.7.0
Show in Project Structure dialog
Affected Modules: app

这是项目 build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    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 = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
            }
        }
    }

这是模块 build.gradle:

plugins {
    id 'com.android.application'
    id 'kotlin-android'
}

android {
    compileSdk 30

    defaultConfig {
        applicationId "com.example.mapboxtest"
        minSdkVersion 14
        targetSdk 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
}

dependencies {

    implementation 'androidx.core:core-ktx:1.6.0'
    implementation 'androidx.appcompat:appcompat:1.3.1'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
    implementation ('com.mapbox.mapboxsdk:mapbox-android-sdk:9.7.0'){
        exclude group: 'group_name', module: 'module_name'
    }
}

我对这类东西很陌生,所以如果问题就在我面前,请告诉我是什么问题。

【问题讨论】:

  • 尝试删除排除组:'group_name',模块:'module_name'行...它将采用组名和模块名称值..不是这个字符串..
  • 你解决了吗?
  • @KashifMehmood 没有
  • @KishanMaurya 已经试过了
  • @KashifMehmood 查看我的最新答案,这就是我想出的所有内容,并且有效

标签: android kotlin sdk dependencies mapbox


【解决方案1】:

所以我还没有完全弄清楚为什么它不能解决
com.mapbox.mapboxsdk:mapbox-android-sdk:9.7.0
但我做了一些研究,尝试了其他版本,发现一个可行的版本就是这个: com.mapbox.mapboxsdk:mapbox-android-sdk:9.2.1
但是这个工作得很好,应用程序编译了所有已解决的引用等。但是如果你弄清楚为什么: com.mapbox.mapboxsdk:mapbox-android-sdk:9.7.0
没有,但如果你弄清楚了,一定要告诉我谢谢!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-04-03
    • 2020-07-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多