【问题标题】:Failed to Resolve: compile 'com.google.firebase:firebase-config:9.2.1'无法解决:编译 'com.google.firebase:firebase-config:9.2.1'
【发布时间】:2016-07-20 05:41:14
【问题描述】:

在 Gradle 文件中添加 Firebse 远程配置 SDK 时出现以下错误

compile 'com.google.firebase:firebase-config:9.2.1'

它会显示错误 Error:(25, 13) Failed to resolve: com.google.firebase:firebase-config:9.2.1 在文件中显示
在项目结构对话框中显示

Gradle 文件:

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.0"

    defaultConfig {
        applicationId "com.bazingalabs.firebaseremoteconfig"
        minSdkVersion 15
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.0.0'
    compile 'com.google.firebase:firebase-config:9.2.1'


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

错误图片

【问题讨论】:

  • 您是否已将类路径“com.google.gms:google-services:3.0.0”添加到您的根 build.gradle 文件中
  • 您能准确地发送您添加此行的位置吗?我们需要确保它位于正确的位置。
  • 发布你的 gradle 结构。
  • 从 sdk manager 更新“Google Play Services”和“Google Repository”
  • @RiyazAhamed 谢谢它的工作......

标签: android firebase-remote-config


【解决方案1】:

@RiyazAhamed 谢谢。解决方案是从 sdk manager 更新“Google Play Services”和“Google Repository”并重新启动 Android Studio。

【讨论】:

  • 我已更新 Google Play 服务和 Google 存储库。但是,仍然不适合我。 Unable to resolve dependency for ':client@debug/compileClasspath': Could not resolve com.google.firebase:firebase-config:16.0.0
【解决方案2】:

这里有一个错误:

将此添加到您的 gradle 文件中。

packagingOptions {
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/LICENSE-FIREBASE.txt'
    exclude 'META-INF/notice'
}

我使用过 Firebase 消息传递

应该是这样的

Gradle:应用程序

apply plugin: 'com.google.gms.google-services' //Usually they put this at the bottom (below dependencies {}
                                               // but it worked for me at the top also

android {
   defaultConfig { ... }
   buildTypes { .... }

    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE-FIREBASE.txt'
        exclude 'META-INF/notice'
    }
}

dependencies {
      compile fileTree(include: ['*.jar'], dir: 'libs')
      testCompile 'junit:junit:4.12'
      compile 'com.google.firebase:firebase-core:9.2.1'
      compile 'com.firebaseui:firebase-ui:0.3.1'
      compile 'com.google.firebase:firebase-messaging:9.2.1'
}

Gradle:项目

dependencies {
    ...
    classpath 'com.google.gms:google-services:3.0.0'

}

【讨论】:

    【解决方案3】:

    在你的依赖项下面添加这个:

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

    【讨论】:

    • 已添加仍然显示错误,还在项目级 gradle 文件中添加了类路径 'com.google.gms:google-services:3.0.0'
    猜你喜欢
    • 1970-01-01
    • 2022-01-10
    • 2017-07-17
    • 2017-11-15
    • 2021-06-28
    • 2019-03-30
    • 2019-03-30
    • 2021-04-20
    • 2018-11-08
    相关资源
    最近更新 更多