android - 添加 Mapbox 导航 SDK 包后无法同步 gradle 项目。它显示一些不相关的错误

标签 android gradle android-gradle-plugin mapbox mapbox-android

这个问题在这里已经有了答案:





Failed to resolve: com.android.support:cardview-v7:26.0.0 android

(26 个回答)


4年前关闭。




这是我的 gradle 文件。我使用的是 Appcompat 25.3.1 版本,但错误出现在 Appcompat 26.1.0 上。删除导航 SDK 包时,此错误会消失。我不明白发生了什么。任何帮助是极大的赞赏。

apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "26.0.2"
defaultConfig {
    applicationId "com.example.aadhilahmed.test3"
    minSdkVersion 15
    targetSdkVersion 25
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
  }
}

repositories{
    mavenCentral()
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.mapbox.mapboxsdk:mapbox-android-navigation:0.6.2' //error is here
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
}

这是我的错误信息:
Failed to resolve: com.android.support.appcompat-v7:26.1.0
      Error:- Install repository and sync project.
               Open file.
               Show in Project Structure Dialog.

即使单击安装存储库和同步项目也绝对没有任何作用。

最佳答案

将此添加到您的repositories 中阻止您的项目级别build.gradle文件:

 allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}

关于android - 添加 Mapbox 导航 SDK 包后无法同步 gradle 项目。它显示一些不相关的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46967604/

相关文章:

java - 限制数组中的小数位

android - 如何从 Ubuntu 的终端在 Android Studio 中打开一个已经创建的项目?

android - 无法编译 ThreeTenABP

Gradle ,复制和重命名文件

java - 无法获取 com.android.build.gradle.internal.api.DefaultAndroidSourceSet 类型的源集 main 的未知属性 'output'

android - 使用 flavor 签名配置覆盖调试构建类型签名配置

android - Gradle 依赖项 : Get latest snapshot from remote repo

android - 使用事件总线解耦 Android 应用程序

Android 图像缓存 - 如何?

spring - spring-framework v4.2.4.RELEASE测试在RepeatedSpringRunnerTests上失败