android - 我突然在Gradle的Android Studio中收到Play-Service-app-indexing:10.0.1错误

标签 android android-studio google-play-services

错误:(41,13)无法解决:com.google.android.gms:play-services-appindexing:10.0.1

这是我在Android Studio中的项目的build.gradle文件,错误突然出现。

apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
    applicationId "com.example.pandey.nidhiiot"
    minSdkVersion 16
    targetSdkVersion 25
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
 }

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.google.android.gms:play-services:10.0.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.google.android.gms:play-services:10.0.1'
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.android.support:design:25.1.1'
compile 'com.google.firebase:firebase-appindexing:10.0.0'
testCompile 'junit:junit:4.12'
apk 'com.google.android.gms:play-services:10.0.1'
compile 'com.google.firebase:firebase-appindexing:10.0.1'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:support-v4:25.1.1-beta1'
// Glide image library
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.google.android.gms:play-services-appindexing:10.0.1'

   }

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

最佳答案

引用此post,您应该删除

compile 'com.google.android.gms:play-services-appindexing:10.0.1'

因为使用下面的新库依赖关系就足够了。
compile 'com.google.firebase:firebase-appindexing:10.0.0'

我复制了gradle文件的一部分以获得依赖关系,并且遇到了相同的情况。在删除重复项(compile 'com.google.android.gms:play-services:10.0.1')并如上所述替换依赖项之后,构建成功。
dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'com.google.android.gms:play-services:10.0.1'
    compile 'com.google.firebase:firebase-core:10.0.1'
    compile 'com.android.support:appcompat-v7:25.1.1'
    compile 'com.android.support:design:25.1.1'
    compile 'com.google.firebase:firebase-appindexing:10.0.1'
    testCompile 'junit:junit:4.12'
    apk 'com.google.android.gms:play-services:10.0.1'
    compile 'com.google.firebase:firebase-appindexing:10.0.1'
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:support-v4:25.1.1-beta1'
    // Glide image library
    compile 'com.github.bumptech.glide:glide:3.7.0'

}

关于android - 我突然在Gradle的Android Studio中收到Play-Service-app-indexing:10.0.1错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42508626/

相关文章:

android - 如何在 ubuntu 20 LTS 中为 android studio 创建启动器图标?

java - 我正在尝试使用 android studio 应用程序将 String 转换为数组然后转换为整数

java - 如何修复错误: Unnecessarily replacing a task that does not exist has been deprecated

android - 与 GoogleApiClient 连接,尽管它已经连接

android - 如何更改选项菜单的语言?

java - 如何修复 ViewHolder 上的 "NullPointerException"?

android - 如何将弹跳动画应用于我的 TextView ?

android - ActionBarSherlock 堆叠操作栏样式问题

Android google play 服务重复条目

android - 我得到 "Error: No resource found that matches the given name (at value with value @integer/google_play_services_version)"