无法解析:com.google.firebase:firebase-core:11.0.0

4

我看到有人问过这个问题,回答大致是重新同步项目并更新 SDK。我正在开始一个新项目,并尝试使用 firebase 进行身份验证,但我遇到了以下错误:

难道安卓工作室就讨厌我吗?

错误:无法解决 com.google.firebase:firebase-core:11.0.0 Open File
在 "项目结构" 对话框中显示 错误:错误:行 (29) 无法解决 com.google.firebase:firebase-auth:11.0.0 Show in File
在 "项目结构" 对话框中显示


1
你在项目gradle中设置了classpath 'com.google.gms:google-services:3.1.0'并应用了插件'com.google.gms.google-services'吗? - Pavel Poley
https://stackoverflow.com/q/44499458/4625829 - AL.
7个回答

10

请前往"工具" > "安卓" > "SDK管理器",点击"SDK工具"并更新以下内容:

  • Google代码库
  • 安卓SDK平台工具

点赞肯定的 ;) - nick
1
我已经更新了这两个,但我仍然收到OP相同的错误。 - Alyoshak

4

只需打开SDK管理器,更新Google仓库即可。


感谢您的合作! - nick
请标记答案为正确以感谢任何人。愉快的编码。 - jitendra purohit
抱歉,我是个新手。 - nick

1

1

我能够通过使用10.0.0解决这个问题。

感谢大家的帮助。

Nick


我刚刚尝试按照Firebase官网(今天)上的说明使用11.2版本进行编译,但是它无法解析,因此我将Firebase版本降至11,并且成功了 =) - Rinaldi Segecin

0

适用于Android Studio 4.1.2。

  1. 首先确保您已从SDK管理器安装了Google Play服务。在Android Studio菜单上的工具中,单击SDK管理器-SDK工具,如果未安装,请安装它。
  2. 将您的应用连接到Firebase。在工具中单击Firebase,Firebase将打开一个新窗口,单击分析。它将引导您进入Firebase网站,在那里创建一个项目,它将自动选择您的项目。 3.当您返回到您的项目时,您将看到“已连接到Firebase” 4.因此,如果运行您的项目并出现错误-找不到com.google.firebase 19.3.1 将以下内容粘贴到您的项目/ build.gradle classpath 'com.google.gms:google-services:4.3.5' 在依赖项中-现在别忘了同步 然后在app/build.gradle文件的底部/末尾粘贴以下内容 apply plugin: 'com.google.gms.google-services' 5.重新构建您的项目,然后再次运行。

NB/classpath 'com.google.gms:google-services:4.3.5'
apply plugin: 'com.google.gms.google-services'

如果有帮助,请留下评论。


-1

请确保您的项目级别 build.gradle 文件包含以下内容:

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

-2

代码行顺序对于Gradle非常重要。

1) buildscript { ext.kotlin_version = '1.2.20'

repositories {
    maven { url "https://maven.google.com" }
    maven { url 'https://plugins.gradle.org/m2/'}
}

dependencies {
    classpath 'com.android.tools.build:gradle:2.3.3'
    classpath 'com.google.gms:google-services:3.0.0'//3.2.0
    classpath 'com.google.firebase:firebase-plugins:1.0.4'
    classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.8.1'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

2)

dependencies {
compile project(':libraries')
compile fileTree(include: ['*.jar'], dir: 'libs')
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
//--------------------------------- One Signal-------------------
//compile 'com.onesignal:OneSignal:[3.1.1, 3.3.99]'
compile 'com.google.android.gms:play-services-gcm:11.0.4'
compile 'com.google.android.gms:play-services-location:11.0.4'
compile 'com.google.firebase:firebase-core:11.0.4'
compile 'com.google.firebase:firebase-messaging:11.0.4'
//-------------------------------------------------------------
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:percent:26.0.0-alpha1'
compile 'com.android.support:design:26.0.0-alpha1'
compile 'com.android.support:support-v4:26.0.0-alpha1'
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
compile 'com.android.support:recyclerview-v7:26.0.0-alpha1'
compile 'com.android.support:cardview-v7:26.0.0-alpha1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
}

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

祝你好运


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接