android - 为什么我在应用 firebase 和 google 身份验证库时收到 list 合并错误

标签 android manifest

我正在尝试将我的应用程序连接到 firebase 并使用其中的 google 身份验证系统

应用库时,我收到明显合并错误 错误在这一行

implementation 'com.google.firebase:firebase-core:17.0.0'

这是我得到的错误

ERROR: Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
    is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
    Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:5:5-23:19 to override.

将版本降级到 16.0.0 时,错误消失了,但是我无法添加任何其他库,例如,如果我想添加

implementation 'com.google.firebase:firebase-auth:18.0.0'

我收到此错误

ERROR: In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[15.0.
1]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.

Dependency failing: com.google.android.gms:play-services-stats:15.0.1 -> com.google.android.gms:play-services-basement@[
15.0.1], but play-services-basement version was 17.0.0.

The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art
ifact with the issue.
-- Project 'app' depends onto com.google.firebase:firebase-core@{strictly 16.0.0}
-- Project 'app' depends onto com.google.android.gms:play-services-flags@{strictly 17.0.0}
-- Project 'app' depends onto com.google.firebase:<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="096f607b6c6b687a6c24687c7d6149383127392739" rel="noreferrer noopener nofollow">[email protected]</a>
-- Project 'app' depends onto com.google.firebase:<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a6c0cfd4c3c4c7d5c38bc5c9d4c3e6979088968896" rel="noreferrer noopener nofollow">[email protected]</a>
-- Project 'app' depends onto com.google.firebase:firebase-analytics-impl@{strictly 16.0.0}

我是 Android 新手,任何建议都会很棒

这是我的应用程序 build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.firebasetestingprojecttwo"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.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'
    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'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support:gridlayout-v7:28.0.0'


    implementation 'com.google.firebase:firebase-core:17.0.0'

}

apply plugin: 'com.google.gms.google-services'

最佳答案

我目前使用的是以下版本。试试这个,这可能会起作用。 将 firebase-core 版本降级至 16.0.0

implementation 'com.google.firebase:firebase-core:16.0.0'

并将 firebase-auth 版本设置为 11.6.0

implementation 'com.google.firebase:firebase-auth:11.6.0'

关于android - 为什么我在应用 firebase 和 google 身份验证库时收到 list 合并错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56795259/

相关文章:

javascript - 使用不同的图标重新渲染标题 - React Native

android - Android中的OpenCV图像比较

德尔福7 : Execute application with administrator privileges

web-applications - 我可以在 Chrome 中清除网络应用程序吗?

android - 如何在访问产品页面时提示用户下载应用程序?

android - 获取元素 Jetpack Compose 的高度

java - fragment 在应用程序启动时不显示 (onCreate),但在它恢复时显示 (onResume)

java - 将软件包与 list 文件一起打包在 jar 文件中

Python m3u8 ssl.CertificateError 问题

android - 在市场上找不到应用程序