2016-11-22 54 views
26

虽然设置compile 'com.google.android.gms:play-services-appindexing:10.0.0'它给以下错误:无法解析:`com.google.android.gms:发挥服务-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:[email protected]' 
    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' 
+0

这是奇怪..:思考:。你有更新你的SDK吗? –

+0

你可以发布你的build.gradle在你的伫列里吗?这将有助于理解您的问题 –

+0

同时检查您是否在您的gradle级别添加了** classpath'com.google.gms:google-services:3.0.0'**或不是 –

回答

25

现在,谷歌Play服务版本10.0。1已经发布了这样替换此 compile 'com.google.android.gms:play-services-appindexing:10.0.0'

通过​​

34

你正在寻找的appindexing库现在是一个新的目标的gradle下。

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

可以看到了最新的库,在这里:https://firebase.google.com/docs/android/setup#available_libraries

+1

这只如果操作使用火力点,则工作。我立场纠正。 –

+0

但是,如果我们在这里检查https://developers.google.com/android/guides/setup,他们已经支持com.google.android.gms:play-services-appindexing:10.0.0 –

+0

感谢您指出。该页面已更新以显示名称更改。之前的API仍然可用于此新的Gradle目标,因此不需要更改代码,除非更改构建目标并将Firebase添加到项目中。 –

12

嗨,任何时候你遇到这种类型的错误,首先要做的通常是检查您的Android Studio中是否安装了最新版本的Google存储库。我有同样的问题,更新后,一切正常。希望能帮助到你。

+0

准确的问题,我有:) – ZimaXXX

+0

我刚刚检查出来。它的更新,但仍然有相同的问题 –

+0

谢谢你@ O'Kamiye – Micle

4

我必须做两件事情。 地址:

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

这显然是新的。此API现在被列为所有Google Play服务设置API中的唯一Firebase API,此处为https://developers.google.com/android/guides/setup。同时删除了“发挥服务-appindexing”编译这个API取代:

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

我几个月前删除“播放服务的广告”编译初次安装火力的服务,通过文档的指示,尽管包括它不会像现在包括'play-services-appindexing'一样崩溃项目编译。

在上传发布APK,我发现了三个权限可惜现在加入到我的权限提升我的SDK和加入“火力-appindexing”编译后。这些不在我的清单中:android.permission.READ_EXTERNAL_STORAGE,android.permission.READ_PHONE_STATE和android.permission.WRITE_EXTERNAL_STORAGE

编辑12/9/16:由Gaurav评论,play-services版本10.0.1已经消除READ_PHONE_STATE,READ_EXTERNAL_STORAGE和WRITE_EXTERNAL_STORAGE的增加“危险”的权限,导致我从10.0.0版本清单合并预期。这些权限会调用一个特殊的对话框,阻止用户继续使用您的应用程序('这个游戏试图接管我的手机吗?')。如果您使用Firebase编译,请务必将所有这些升级到10.0.1。它们不会像游戏服务编译一样变成灰色,这是应用程序gradle升级警告中的一个不幸的不一致。如果你忽视升级firebase编译以匹配play-services编译,你会得到臭名昭着的'使用play-services'项目编译失败后无法访问zzanb - Firebase Error cannot access zzanb after using play-services-xxx:9.8.00

+1

你是对的,它现在是'firebase-appindexing',我也不得不改变实现代码。请参阅:https://github.com/googlecodelabs/app-indexing –

+1

我也必须更改实施代码。 显然你现在必须指定一个索引对象和一个动作对象。 非常混乱。特别是因为索引对象只需要添加一次(我想跟踪添加的索引)和每次用户执行操作时的操作对象。 出于某种原因,我不会在谷歌搜索工具栏中得到任何结果。 –

+1

我想用10.0.1解决新添加的权限问题。让我们知道你的经验。 –

相关问题