我正在尝试使用 Firebase-UI 库将 Facebook 登录功能集成到我的 Android 应用中。我正在关注本教程 - https://firebase.google.com/docs/auth/android/firebaseui?authuser=0
但是我在尝试构建 gradle 时遇到以下错误:
The library com.google.android.gms:play-services-basement is being requested by various other libraries at [[15.0.1,15.0.1]], but resolves to 16.0.1. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.
下面是我的应用程序级别build.gradle
文件
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "company.com.mygame"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.0'
implementation 'com.facebook.android:facebook-android-sdk:4.37.0'
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.firebaseui:firebase-ui-auth:4.2.0'
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'
我看到了下面的链接 -
com.google.android.gms:play-services-measurement-base is being requested by various other libraries
https://github.com/OneSignal/OneSignal-Gradle-Plugin/issues/37
但是我收到了这个错误 -
Manifest merger failed : uses-sdk:minSdkVersion 15 cannot be smaller than version 16 declared in library [com.firebaseui:firebase-ui-auth:4.2.0] C:\Users\me\.gradle\caches\transforms-1\files-1.1\firebase-ui-auth-4.2.0.aar\xxx\AndroidManifest.xml as the library might be using APIs not available in 15
Suggestion: use a compatible library with a minSdk of at most 15,
or increase this project's minSdk version to at least 16,
or use tools:overrideLibrary="com.firebase.ui.auth" to force usage (may lead to runtime failures)
但是问题还没有解决。我刚刚开始学习android,不知道我错过了什么。
最佳答案
我也遇到了同样的问题
只需确保您拥有所有依赖项的最新版本。我使用了 Firebase 核心和身份验证的当前版本。
您可以从here获取最新版本。 使用当前时间点的最新版本:
在app/build.gradle中:
dependencies {
...
// Add these code
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.google.firebase:firebase-auth:16.2.0'
}
在 android/build.gradle 中:
buildscript {
ext {
...
minSdkVersion = 16
...
}
}
关于android - 构建 gradle 时出错 - com.google.android.gms :play-services-basement is being requested by various other libraries,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52697082/