[英]ERROR: Failed to resolve: com.google.firebase:firebase-core:
Gradle sync fails while trying to build the firebase app!尝试构建 firebase 应用程序时,Gradle 同步失败!
ERROR: Failed to resolve: com.google.firebase:firebase-core:
错误:无法解析:com.google.firebase:firebase-core:
Affected Modules: firebase_core受影响的模块:firebase_core
This is my project-level build.gradle这是我的项目级 build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
and app level build.gradle dependencies和应用级 build.gradle 依赖项
dependencies {
implementation 'com.google.firebase:firebase-core:16.0.8'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
apply plugin: 'com.google.gms.google-services'
EDIT: The error seems to be due to Flutter Firebase_auth plugin!编辑:错误似乎是由于 Flutter Firebase_auth 插件!
I had a similar problem.我有一个类似的问题。 When I look at the error message in detail, I get the following message.
当我详细查看错误消息时,我收到以下消息。
Duplicate class android.support.v4.app.INotificationSideChannel found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:26.1.0) code here
The problem is that the same class exists in the androidx and firebase packages.问题是 androidx 和 firebase 包中存在相同的类。 Add the following options to the gradle.properties file.
将以下选项添加到 gradle.properties 文件中。
android.useAndroidX=true
android.enableJetifier=true
In my case, this was solved.就我而言,这已解决。
In project level gradle add following在项目级别的gradle中添加以下内容
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}
I believe that this issue was fixed in the 0.3.4 update of firebase_core, which is a dependency of other Flutter Firebase plugins.我相信这个问题在 firebase_core 的 0.3.4 更新中得到了修复,它是其他 Flutter Firebase 插件的依赖项。 Try a "flutter packages upgrade" and see if that fixes it for you.
尝试“颤振包升级”,看看是否可以为您解决问题。
https://github.com/flutter/plugins/pull/1464/files https://github.com/flutter/plugins/pull/1464/files
Looks like google-service.json file is missing or is invalid.看起来google-service.json文件丢失或无效。 Adding google-service.json file from the Firebase console can fix it.
从Firebase控制台添加google-service.json文件可以修复它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.