【问题标题】:Manifest merger failed : Attribute application@appComponentFactory cant solve this清单合并失败:属性 application@appComponentFactory 无法解决此问题
【发布时间】:2019-11-23 02:50:09
【问题描述】:

我是 android 新手,并且有一个应用程序在构建我的项目时出现此错误 ::

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

我的 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'
}

和 manifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="maa.tic_tac_to">

    <uses-permission android:name="android.permission.SEND_SMS" />
    <uses-permission android:name="android.permission.RECEIVE_SMS" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/tic_tac_toe"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">


        <activity android:name=".MainActivity"></activity>

        <receiver
            android:name=".MySMSReceiver"
            android:enabled="true"
            android:exported="true">
            <intent-filter>
                <action android:name="android.provider.Telephony.SMS_RECEIVED" />
            </intent-filter>
        </receiver>

        <activity android:name=".FakeActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".LogInActivity"></activity>


        <service
            android:name=".MyFirebaseMessagingService">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
            </intent-filter>
        </service>
    </application>

</manifest>

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

【问题讨论】:

  • 哎呀,没人能帮我!!!!

标签: java android firebase android-support-library androidx


【解决方案1】:

你正在使用

implementation 'com.google.firebase:firebase-messaging:19.0.1'

Firebase 在最新版本中迁移到了 AndroidX。 这意味着您同时使用了支持库和 androidx 库。

你可以:

  • 如下所述迁移到 androidx
  • 降级您的 Firebase 依赖项(但这不是真正的解决方案,因为您迟早必须迁移)

您可以查看official release notes

警告:此版本是主要版本更新和重大更改。 Google Play 服务和 Firebase 的最新更新包括以下更改:

从 Android 支持库迁移到 Jetpack (AndroidX) 库。除非您在应用中进行以下更改,否则库将无法运行:

  • com.android.tools.build:gradle 升级到v3.2.1 或更高版本。
  • compileSdkVersion 升级到 28 或更高版本。
  • 更新您的应用以使用 Jetpack (AndroidX);按照Migrating to AndroidX 中的说明进行操作。

【讨论】:

  • 感谢兄弟我迁移到 AndroidX 并将导入更改为 AndroidX 及其现在的工作
  • 嗨@hossein。如果此答案或任何答案解决了您的问题,请单击复选标记考虑accepting it。这向更广泛的社区表明您已经找到了解决方案,并为回答者和您自己提供了一些声誉。没有义务这样做
猜你喜欢
  • 2019-08-08
  • 1970-01-01
  • 2019-11-19
  • 1970-01-01
  • 1970-01-01
  • 2019-11-02
  • 1970-01-01
相关资源
最近更新 更多