构建gradle时出错 - com.google.android.gms:各种其他库正在请求play-services-basement

问题描述 投票:2回答:2

我正在尝试使用Firebase-UI库将Facebook登录功能集成到我的Android应用程序中。我正在关注本教程 - https://firebase.google.com/docs/auth/android/firebaseui?authuser=0

但是在尝试构建gradle时我遇到了以下错误:

com.google.android.gms库:play-services-basement正在[[15.0.1,15.0.1]]的各个其他图书馆请求,但已解析为16.0.1。禁用插件并使用./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,不知道我错过了什么。

android firebase build.gradle firebaseui facebook-authentication
2个回答
2
投票

我遇到过同样的问题

只需确保您拥有所有依赖项的最新版本。我使用Firebase核心和auth的当前版本。

您可以从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
        ...
    }
}

1
投票

你的错误说:uses-sdk:minSdkVersion 15 cannot be smaller than version 16和你的build.gradleminSdkVersion 15。尝试将其更改为16,看看它是否适合您。

学习android的最好的。愿原力与你同在。

完了,走吧,

阿希什

© www.soinside.com 2019 - 2024. All rights reserved.