如何解决“清单合并错误"?由于Firebase数据库实施 [英] How to fix "manifest merger error" due to the Firebase Database implementation

查看:86
本文介绍了如何解决“清单合并错误"?由于Firebase数据库实施的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个23 API应用程序,并且需要添加Firebase数据库服务.当我添加行

I'm coding an 23 API app, and i need to add Firebase Database services. When i add the line

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

在gradle应用中,我尝试同步,但显示失败:

in the gradle app and i try to sync, it failes showing this:

 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:15:5-48:19 to override.

有人可以帮我吗?

这是我的应用gradle文件

This is my app gradle file

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28

    defaultConfig {
        applicationId "com.QUeM.TreGStore"
        minSdkVersion 23
        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'])
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'

    // Glide image library
    implementation 'com.github.bumptech.glide:glide:4.3.1'

    //dipendenza per firebase
    implementation 'com.google.firebase:firebase-core:11.8.0'
    implementation 'com.google.firebase:firebase-database:18.0.0'

    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:support-annotations:28.0.0'
    implementation 'android.arch.lifecycle:extensions:1.1.1'

    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.google.android.gms:play-services-vision:11.8.0'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'

}

//plugin per l'utilizzo di firebase
apply plugin: 'com.google.gms.google-services'

推荐答案

如果要使用implementation 'com.google.firebase:firebase-database:18.0.0,则必须执行以下操作:

If you want to use implementation 'com.google.firebase:firebase-database:18.0.0 then you have to do the following:

文档:

此版本是主要版本更新,其中包含重大更改. 在此版本中,库从Android支持库迁移到Jetpack(AndroidX)库. 除非您在应用中进行以下更改,否则更新的库将无法工作:

This release is a MAJOR version update and includes breaking changes. With this release, libraries are migrated from the Android Support Libraries to the Jetpack (AndroidX) Libraries. The updated libraries will not work unless you make the following changes in your app:

  • com.android.tools.build:gradle升级到v3.2.1或更高版本.

  • Upgrade com.android.tools.build:gradle to v3.2.1 or later.

compileSdkVersion升级到28或更高版本.

Upgrade compileSdkVersion to 28 or later.

要将其他依赖项迁移到androidx程序包,可以执行以下操作:

To migrate the other dependencies to androidx package, you can do the following:

在Android Studio 3.2及更高版本中,您可以通过从菜单栏中选择重构>迁移到AndroidX ,来快速迁移现有项目以使用AndroidX.

With Android Studio 3.2 and higher, you can quickly migrate an existing project to use AndroidX by selecting Refactor > Migrate to AndroidX from the menu bar.

检查此以获取更多信息:

Check this for more info:

https://developer.android.com/jetpack/androidx/migrate#migrate

这篇关于如何解决“清单合并错误"?由于Firebase数据库实施的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆