android - 谷歌移动视觉库11.8.0无法识别

标签 android android-gradle-plugin build.gradle android-studio-3.0

<分区>

我在 Android Studio 3.0 中使用 Gradle 版本 4.1 和 Android 插件版本 3.0.0。 在我的项目中,我正在尝试使用 Google Play 服务的移动视觉库。

如果我在 Gradle 构建脚本中为我的应用配置依赖项


    dependencies {
    ...
     implementation 'com.google.android.gms:play-services-vision:10.2.0' 
    }

然后 Gradle 可以很好地与我的 Android 项目同步,但会标记一条警告消息:“比 10.2.0 更新的 com.google.android.gms:play-services-vision 版本可用:11.8.0”。 但是如果我用

配置我的 build.gradle

    dependencies{
    ...
     implementation 'com.google.android.gms:play-services-vision:11.8.0'
    }

然后我收到以下错误:“Error:(29, 20) Failed to resolve: com.google.android.gms:play-services-vision:11.8.0

build.gradle 脚本的其余部分(没有依赖项部分)如下所示:


    apply plugin: 'com.android.application'

    android {
        compileSdkVersion 25
        buildToolsVersion "26.0.2"
        defaultConfig {
            applicationId "{something something}"
            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'
            }
        }
    }

有人可以帮我解决这个问题吗?

最佳答案

确保您的顶级 build.gradle 包含对 google() 存储库或 maven { url "https://maven.google.com "} 的引用。

像这样-

allprojects {
    ...

    repositories {
        ...
        maven { url "https://maven.google.com" }
    }
}

关于android - 谷歌移动视觉库11.8.0无法识别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48081249/

相关文章:

android - Android Studio中这两个Gradle是什么意思?

Android Studio gradle 构建时间过长

android - 找不到 com.android.support :design-23. 2.1 和找不到 com.android.support.appcompat-v7-23.2.1 错误

android - TextView drawableStart的显示bug怎么解释?

android - 为什么 Android 上的每个 App 都有一个单独的 VM(Dalvik/ART) 实例?

android - 如何将 aar 库上传到 Nexus?

android - 在前缀为 : mips64el-linux-android 的 ABI 的 NDK 工具链文件夹中找不到工具链

android - 如何修复在构建项目时收到的 atp0000 错误?

Android google登录始终显示handleSignInResult :false

android - 在 Android Studio 中升级 gradle 的正确方法是什么?