31

设置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.

如果有人能告诉我这有什么问题,将不胜感激,因为休息播放服务版本 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'
4

4 回答 4

38

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

你想添加compile 'com.google.firebase:firebase-appindexing:10.0.0'到你的应用程序的build.gradle文件:)

您可以在此处查看最新的库。

于 2016-11-22T02:00:04.147 回答
27

现在 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'

于 2016-11-29T13:05:01.363 回答
12

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

于 2016-11-22T09:14:12.473 回答
5

我必须做两件事。添加:

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

这显然是新的。此 API 现在在此处列为所有 Google Play 服务设置API 中唯一的 firebase API。还删除了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现在一样使项目编译崩溃。

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

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

2016 年12 月 9 日编辑:正如 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 错误在使用 play-services-xxx:9.8.00 后无法访问 zzanb

于 2016-11-22T16:45:32.983 回答