【问题标题】:Failed to resolve: com.google.firebase:firebase-auth:11.4.0 [duplicate]无法解决:com.google.firebase:firebase-auth:11.4.0 [重复]
【发布时间】:2017-10-03 11:36:17
【问题描述】:

这些是我的应用程序 gradle 文件中的依赖项。我该如何解决这个错误?

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.android.support:appcompat-v7:26.+'
    androidTestCompile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.google.firebase:firebase-database:11.4.0'
    compile 'com.google.firebase:firebase-crash:11.4.0'
    compile 'com.google.firebase:firebase-auth:11.4.0'
    androidTestCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

【问题讨论】:

  • 您是否已将 googleService.json 粘贴到您的项目中
  • 是的,我已将 JSON 文件粘贴到我的应用文件夹中。
  • 然后尝试下面提到的解决方案
  • @SayanSahoo 欢迎来到 Stack Overflow。检查下面给出的答案,如果它解决了您的问题,则将最佳答案标记为已接受。

标签: android firebase


【解决方案1】:

将此包含在您的根级(不是应用级)bulid.gradle 文件中:

allprojects {
    // ...
    repositories {
        // ...
        maven {
            url "https://maven.google.com" // Google's Maven repository
        }
    }
}

更多说明请查看Firebase Integration Guide.

【讨论】:

  • 粘贴它们后我收到这些错误 在包 'com.example.syan.appfire' 中找不到属性 'layout_constraintTop_toTopOf' 的资源标识符 在包 'com.example.syan.appfire' 中找不到属性'layout_constraintLeft_toLeftOf'的资源标识符example.syan.appfire'
  • 您可能已经删除了约束布局依赖项。发布你的两个 build.gradle 文件。
  • 根级别依赖项依赖项 { classpath 'com.android.tools.build:gradle:2.3.3' classpath 'com.google.gms:google-services:3.1.0' } allprojects { repositories { jcenter() maven { url "maven.google.com" // Google 的 Maven 仓库 } } }
  • 依赖项 { androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 排除组:'com.android.support',模块:'support-annotations ' }) 编译 'com.android.support:appcompat-v7:26.+' androidTestCompile 'com.android.support.constraint:constraint-layout:1.0.2' 编译 'com.google.firebase:firebase-database:11.4 .0' 编译 'com.google.firebase:firebase-crash:11.4.0' 编译 'com.google.firebase:firebase-auth:11.4.0' androidTestCompile 'junit:junit:4.12' }
  • 在您的应用级 build.gradle 文件中添加 compile 'com.android.support.constraint:constraint-layout:1.0.2' 作为依赖项。
【解决方案2】:

maven { url "https://maven.google.com" } 添加到您的根级别build.gradle 文件

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}

【讨论】:

  • 粘贴后我收到这些错误 在包'com.example.sayan.appfire'中找不到属性'layout_constraintTop_toTopOf'的资源标识符 在包'com.example.syan.appfire'中找不到属性'layout_constraintLeft_toLeftOf'的资源标识符。 example.syan.appfire'
  • 在你的 build.gradle 文件中添加依赖 compile 'com.android.support.constraint:constraint-layout:1.0.2'
  • 我已经把它写在那里了。但我仍然收到这些错误!
  • 哦对不起!是的,谢谢:D
  • 没问题,我很高兴 :)
猜你喜欢
  • 2016-09-19
  • 2018-02-23
  • 1970-01-01
  • 2016-09-15
  • 2018-03-16
  • 2018-11-26
  • 2018-03-27
  • 2018-03-07
  • 2020-05-02
相关资源
最近更新 更多