无法解析com.google.firebase:firebase-appindexing:10.0.1

时间:2016-12-27 04:21:58

标签: android firebase firebase-authentication

美好的一天,我想在我的Android应用中使用Firebase身份验证。这是我的项目级gradle文件

    buildscript {
    repositories {
    jcenter()
}
    dependencies {

    classpath 'com.android.tools.build:gradle:2.2.2'
    classpath 'com.google.gms:google-services:3.0.0'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}

    allprojects {
    repositories {
    jcenter()
}
}

    task clean(type: Delete) {
    delete rootProject.buildDir
 }

这是我的应用级Gradle文件

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.0"
    defaultConfig {
        applicationId "ibm.examplefirebase1"
        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'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.0.1'
    compile 'com.google.firebase:firebase-auth:10.0.1'
    testCompile 'junit:junit:4.12'
    compile 'com.google.firebase:firebase-database:10.0.1'

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

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

失败显示为

我下载了最新的android存储库版本

我尝试使用最新的支持存储库,但它仍然无法正常工作。

"Error:(32, 13) Failed to resolve: com.google.android.gms:play-services-appindexing:10.0.1"

3 个答案:

答案 0 :(得分:0)

替换

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

使用

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

点击此链接: https://firebase.google.com/docs/android/setup#available_libraries

答案 1 :(得分:0)

您收到此错误,因为没有像com.google.android.gms:play-services-appindexing:10.0.1

这样的模块

com.google.android.gms中可用的模块是:

  • com.google.android.gms:发挥服务:10.0.1
  • com.google.android.gms:发挥服务的广告:10.0.1
  • com.google.android.gms:发挥服务耐磨:10.0.1
  • com.google.android.gms:发挥服务,地图:10.0.1

我认为您需要包含的内容是:com.google.android.gms:play-services:10.0.1

答案 2 :(得分:0)

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.google.firebase:firebase-auth:10.0.1'
testCompile 'junit:junit:4.12'
compile 'com.google.firebase:firebase-database:10.0.1'

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

了解更多详情check my answer here