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

时间:2018-10-08 07:08:18

标签: android firebase build.gradle firebaseui facebook-authentication

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

但是在尝试构建gradle时遇到错误:

  

各种其他库都在[[15.0.1,15.0.1]]请求库com.google.android.gms:play-services-basement,但解析为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,不确定我缺少什么。

2 个答案:

答案 0 :(得分:2)

我遇到了同样的问题

只需确保您具有所有依赖项的最新版本。我将当前版本用于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
        ...
    }
}

答案 1 :(得分:1)

您的错误说:build.gradle,而您的minSdkVersion 1516。尝试将其更改为.tooltip { position: relative; display: inline-block; border-bottom: 1px dotted black; } .tooltip .tooltiptext { visibility: hidden; width: 120px; background-color: black; color: #fff; text-align: center; border-radius: 6px; padding: 5px 0; font-family: consolas,monospace; position: absolute; z-index: 1; } .tooltip:hover .tooltiptext { visibility: visible; },看看是否适合您。

学习Android的所有最佳方法。愿力量与你同在。

一遍又一遍

阿什什语