清单合并失败:属性 application@appComponentFactory 无法解决此问题

我是 android 的新手,有一个应用程序在构建我的项目时有这个错误 ::

错误:清单合并失败:来自 [androidx.core:core:1.0.0] 的属性 application@appComponentFactory 值 =(androidx.core.app.CoreComponentFactory) AndroidManifest.xml:22:18-86 也出现在 [com.android .support:support-compat:28.0.0] AndroidManifest.xml:22:18-91 值=(android.support.v4.app.CoreComponentFactory)。建议:在 AndroidManifest.xml:9:5-44:19 处的元素中添加 'tools:replace="android:appComponentFactory"' 以覆盖。

我的 Gradle 构建是 ::

apply plugin: 'com.android.application'

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


android {

    compileSdkVersion 28

    buildToolsVersion "28.0.3"

    defaultConfig {

        applicationId "maa.tic_tac_to"

        minSdkVersion 19

        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.google.firebase:firebase-messaging:19.0.1'

    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {

        exclude group: 'com.android.support', module: 'support-annotations'

    })

    //   implementation 'com.android.support:appcompat-v7:24.2.1'

    implementation 'com.android.support:appcompat-v7:28.0.0'

    // implementation 'com.android.support:support-v4:28.+'

    // implementation ('com.theartofdev.edmodo:android-image-cropper:2.4.+'){


       // exclude group: 'com.android.support'

    //}

    // implementation 'com.google.android.material:material:1.0.0-alpha08'


    implementation 'com.android.support.constraint:constraint-layout:2.0.0-beta2'

    // implementation 'com.androidx.constraintlayout.widget:ConstraintLayout:2.0.0-beta2'

    testImplementation 'junit:junit:4.12'

}


我在 stackoverflow 和谷歌搜索中测试了每个解决方案,但任何人都可以帮助我。谁能帮忙解决这个错误?!?!?!?


侃侃无极
浏览 143回答 1
1回答

一只斗牛犬

您正在使用implementation 'com.google.firebase:firebase-messaging:19.0.1'Firebase 在最新版本中迁移到了 AndroidX。这意味着您同时使用支持库和 androidx 库。你可以:如下所述迁移到 androidx降级你的 firebase 依赖项(但这不是一个真正的解决方案,因为你迟早要迁移)您可以查看官方发行说明:警告:此版本是主要版本更新和重大更改。Google Play 服务和 Firebase 的最新更新包括以下更改:从 Android 支持库迁移到 Jetpack (AndroidX) 库。除非您在应用程序中进行以下更改,否则库将无法工作:升级com.android.tools.build:gradle到 v3.2.1 或更高版本。升级compileSdkVersion到 28 或更高版本。更新您的应用以使用 Jetpack (AndroidX);按照迁移到 AndroidX中的说明进行操作。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java