Android 添加firebaseUI失败
我正在按照文档将FirebaseUI添加到我的项目中,但我有2个错误(未能找到com.google.android.gms.epotype和google Play服务的提供商信息缺失或未经正确许可) 在依赖项处写入该行时发生此错误:Android 添加firebaseUI失败,android,firebase,firebase-authentication,Android,Firebase,Firebase Authentication,我正在按照文档将FirebaseUI添加到我的项目中,但我有2个错误(未能找到com.google.android.gms.epotype和google Play服务的提供商信息缺失或未经正确许可) 在依赖项处写入该行时发生此错误: implementation 'com.firebaseui:firebase-ui-auth:4.0.0' 我的gradle应用程序: apply plugin: 'com.android.application' repositories {
implementation 'com.firebaseui:firebase-ui-auth:4.0.0'
我的gradle应用程序:
apply plugin: 'com.android.application'
repositories {
mavenLocal()
flatDir {
dirs 'libs'
}
}
android {
compileSdkVersion 24
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.google.firebase.udacity.friendlychat"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
//firebase
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation'com.google.firebase:firebase-database:16.0.1'
implementation'com.google.firebase:firebase-auth:16.0.2'
implementation 'com.firebaseui:firebase-ui-auth:4.0.0' // the problem is here ??
//noinspection GradleCompatible
compile 'com.android.support:design:24.2.0'
compile 'com.android.support:appcompat-v7:24.2.0'
// Displaying images
compile 'com.github.bumptech.glide:glide:3.6.1'
}
apply plugin: 'com.google.gms.google-services'
我的gradle项目:
buildscript {
repositories {
jcenter()
mavenLocal()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:4.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
mavenLocal()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我的日志:
e08-02 08:48:30.431 8422-8440/com.google.firebase.chat E/ActivityThread:未能找到com.google.android.gms.epotype的提供商信息
08-02 08:48:30.510 8422-8443/com.google.chat E/FirebaseInstanceId:
Google Play服务缺失或未经正确许可
08-02 08:48:30.550 8422-8443/com.google.chat E/FirebaseInstanceId:
Google Play服务缺失或未经正确许可
08-02 08:48:30.927 8422-8445/com.google.chat E/ActivityThread:失败
查找com.google.android.gms.chimera的提供商信息
08-02 08:48:31.079 8422-8443/com.google.chat E/FirebaseInstanceId:
Google Play服务缺失或未经正确许可
08-02 08:48:41.128 8422-8443/com.google.chat E/FirebaseInstanceId:
Google Play服务缺失或未经正确许可
要解决此问题,请更改以下代码行:
implementation 'com.firebaseui:firebase-ui-auth:4.0.0'
classpath 'com.google.gms:google-services:4.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
到
以及以下代码行:
implementation 'com.firebaseui:firebase-ui-auth:4.0.0'
classpath 'com.google.gms:google-services:4.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
到
您似乎还需要添加以下代码行:
implementation 'com.firebaseui:firebase-ui-auth:4.0.0'
classpath 'com.google.gms:google-services:4.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
此问题似乎与设备有关,请确保在测试设备上安装了Google Play服务
查看此解决方案:您需要保持所有google服务库的版本相似。 每个Firebase UI版本对应一个特定的Google服务版本 根据文件() 自版本4.1.0起,FirebaseUI具有以下依赖项版本: 图书馆版本 firebase auth 16.0.1 播放服务验证15.0.1 firebase数据库16.0.1 已更新: 对于错误“Google Play服务丢失或未经正确许可”,您可以尝试下面的建议
“下载google play service sdk并在清单中添加访问权限(如果未添加的话)”我找到了错误所在。 我变了
compileSdkVersion 24
到
看起来您使用的是构建工具的版本27,该版本适用于Android API版本27。考虑使用<代码> 24 .x.x< /Cord.Exchange的构建工具。你能用过滤器添加一个来自LogCAT的错误的屏幕截图吗?或者在你的设备上安装了谷歌游戏?可能没有。请安装最新版本并尝试一下。它有效吗?如果您使用定位服务,您还可以在清单文件中添加
ACCESS\u FINE\u LOCATION
权限。我不使用任何定位服务,但我会尝试一下。我不知道你说的在PC上安装Google play是什么意思?从24改为24?