【问题标题】:Failed to resolve: `com.google.android.gms:play-services-appindexing:10.0.0`无法解决:`com.google.android.gms:play-services-appindexing:10.0.0`
【发布时间】:2016-11-22 01:35:37
【问题描述】:

在设置compile 'com.google.android.gms:play-services-appindexing:10.0.0' 时出现以下错误:

Error:(82, 13) Failed to resolve: com.google.android.gms:play-services-appindexing:10.0.0

在设置compile 'com.google.android.gms:play-services-appindexing:9.8.0' 时出现以下错误:

Error:Execution failed for task ':app:processDebugGoogleServices'.
> Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 10.0.0.

如果有人能告诉我这有什么问题,我将不胜感激,因为 rest play services 版本 10.0.0 工作正常。

我的 build.gradle 文件

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.22.0'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
    signingConfigs {

    }
    compileSdkVersion 25
    buildToolsVersion '25.0.0'

    defaultConfig {
        applicationId "com.example.app"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 41
        versionName "2.2.0"
        multiDexEnabled true
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.config
        }
        debug {
            signingConfig signingConfigs.config
        }
    }
    lintOptions {
        checkReleaseBuilds false
    }
}

configurations {
    compile.exclude group: 'stax'
    compile.exclude group: 'xpp3'
}

repositories {
    maven {
        url "http://dl.bintray.com/microsoftazuremobile/SDK"
    }
    maven { url 'https://maven.fabric.io/public' }
}

dependencies {
    //Microsoft azure
    compile 'com.microsoft.azure:azure-notifications-handler:1.0.1@aar'
    compile files('libs/notification-hubs-0.4.jar')

    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:25.0.1'
    compile 'com.android.support:support-v4:25.0.1'
    compile 'com.android.support:recyclerview-v7:25.0.1'
    compile 'com.android.support:cardview-v7:25.0.1'
    compile 'com.android.support:design:25.0.1'
    compile 'com.android.support:palette-v7:25.0.1'

    compile 'com.google.android.gms:play-services-auth:10.0.0'
    compile 'com.google.android.gms:play-services-maps:10.0.0'
    compile 'com.google.android.gms:play-services-analytics:10.0.0'
    compile 'com.google.android.gms:play-services-gcm:10.0.0'
    compile 'com.google.android.gms:play-services-appindexing:10.0.0'
    compile 'com.google.android.gms:play-services-base:10.0.0'

    compile 'com.google.code.gson:gson:2.6.2'
    compile 'com.android.support:multidex:1.0.1'

    //Facebook SDK
    compile 'com.facebook.android:facebook-android-sdk:4.17.0'

}

apply plugin: 'com.google.gms.google-services'

【问题讨论】:

  • 这很奇怪.. :thinking:.你更新你的sdk了吗?
  • 你能在你的问题中发布你的 build.gradle 吗?这将有助于了解您的问题
  • 还要检查您是否在 gradle 级别中添加了 classpath 'com.google.gms:google-services:3.0.0'
  • @NitinKarande 是的,我已经添加了

标签: android android-app-indexing


【解决方案1】:

现在 Google Play Services 版本 10.0.1 已经发布,所以替换这个 compile 'com.google.android.gms:play-services-appindexing:10.0.0'

compile 'com.google.firebase:firebase-appindexing:10.0.1'

【讨论】:

    【解决方案2】:

    您正在寻找的 appindexing 库现在位于新的 gradle 目标下。

    您想将compile 'com.google.firebase:firebase-appindexing:10.0.0' 添加到您应用的build.gradle 文件中:)

    你可以看到最新的libraries here.

    【讨论】:

    • 这仅在 op 使用 firebase 时有效。我的立场是正确的。
    • 但是如果我们在这里查看 developers.google.com/android/guides/setup ,他们已经支持 com.google.android.gms:play-services-appindexing:10.0.0
    • 感谢您指出这一点。该页面已更新以显示名称更改。以前的 API 在这个新的 gradle 目标中仍然可用,因此不需要更改代码,除了更改构建目标并将 Firebase 添加到您的项目中。
    • 我认为最好评论选择的答案,将链接添加到更新的播放服务,而不是提出您自己的独立答案,因为它对于一些新手来说仍然看起来很粗糙。
    【解决方案3】:

    我必须做两件事。 添加:

    compile 'com.google.firebase:firebase-appindexing:10.0.0'
    

    这显然是新的。此 API 现在被列为所有 Google Play 服务设置中唯一的 firebase API APIs here. 也删除 play-services-appindexing 编译此 API 替换:

    //no longer include 'play-services-appindexing' compile
    //compile 'com.google.android.gms:play-services-appindexing:10.0.0
    

    按照文档的指示,几个月前我在第一次安装 firebase 服务时删除了 play-services-ads 编译,尽管包含它不会像现在包含 play-services-appindexing 那样使项目编译崩溃。

    在上传发布 apk 时,不幸的是,在升级我的 sdks 并添加 firebase-appindexing 编译后,我发现三个权限添加到了我所需的权限中。这些不在我的清单中:

    android.permission.READ_EXTERNAL_STORAGE,
    android.permission.READ_PHONE_STATE, and
    android.permission.WRITE_EXTERNAL_STORAGE
    

    编辑 12/9/16: 正如 Gaurav 评论的那样,play-services version 10.0.1 已经消除了 READ_PHONE_STATE, READ_EXTERNAL_STORAGE, and WRITE_EXTERNAL_STORAGE, 添加的“危险”权限,因此我期望在版本 10.0.0. 中进行清单合并这些权限调用一个特殊的对话框,可以阻止您的用户继续使用您的应用程序(“这个游戏是否试图接管我的手机?”)。如果您使用 firebase 编译,请务必将所有这些都升级到 10.0.1。它们不会像 play-services 编译那样灰显,这是应用程序升级警告中不幸的不一致。如果您忽略升级 firebase 编译以匹配 play-services 编译,您会得到臭名昭著的“使用 play-services 后无法访问 zzanb”项目编译崩溃 - Firebase Error cannot access zzanb after using play-services-xxx:9.8.00

    【讨论】:

    • 你是对的,它现在是`firebase-appindexing',我也不得不更改实现代码。参考:github.com/googlecodelabs/app-indexing
    • 我还必须更改实现代码。显然,您现在必须指定一个索引对象和一个操作对象。非常混乱。特别是因为索引对象只需要添加一次(我想跟踪添加的可索引对象??)和每次用户做某事时的操作对象。出于某种原因,我不会再在 google 搜索工具栏中得到任何结果。
    • 我想在 10.0.1 中添加新权限的问题已经解决。让我们知道您的经历。
    【解决方案4】:

    您好,每当您遇到此类错误时,首先要做的通常是检查您的 Android Studio 中是否安装了最新版本的 google 存储库。我有同样的问题,更新后一切正常。希望对您有所帮助。

    【讨论】:

    • 正是我遇到的问题:)
    • 我刚刚检查过了。它已更新,但仍然有同样的问题
    猜你喜欢
    • 2018-01-04
    • 1970-01-01
    • 2019-04-15
    • 2018-11-23
    • 1970-01-01
    • 2016-10-09
    • 2017-03-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多