【问题标题】:Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory [duplicate]清单合并失败:属性 application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory [重复]
【发布时间】:2019-06-20 23:23:33
【问题描述】:
apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    buildToolsVersion "28.0.3"
    defaultConfig {
        applicationId "com.it.munchies"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        useLibrary 'org.apache.http.legacy'
        multiDexEnabled true

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    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:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    testImplementation 'junit:junit:4.12'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.volley:volley:1.1.0'
    implementation 'com.google.code.gson:gson:2.8.2'

    implementation 'com.facebook.android:facebook-android-sdk:4.8.0'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.google.firebase:firebase-messaging:19.0.0'
    implementation 'com.google.firebase:firebase-auth:18.0.0'
    implementation 'com.google.android.gms:play-services-auth:17.0.0'
    implementation 'com.google.firebase:firebase-core:17.0.0'
    implementation 'com.google.android.gms:play-services-maps:17.0.0'
    implementation 'com.google.android.gms:play-services-places:17.0.0'
    implementation 'com.daimajia.swipelayout:library:1.2.0@aar'
    implementation files('libs/httpmime-4.2.1.jar')
    implementation 'me.leolin:ShortcutBadger:1.1.9@aar'
// routing
    implementation 'com.github.jd-alexander:library:1.0.7'
    implementation('io.socket:socket.io-client:0.8.3') {
        // excluding org.json which is provided by Android
        exclude group: 'org.json', module: 'json'
    }
}

// For FCM
apply plugin: 'com.google.gms.google-services'

当我更新 android studio 时出现此错误:

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:18:5-91:19 to override.

我也有这个错误,但是在 gradle 文件中 ::::

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0, 23.0.1. Examples include com.android.support:animated-vector-drawable:28.0.0 and com.android.support:support-v4:23.0.1 more... (Ctrl+F1

【问题讨论】:

标签: android firebase android-gradle-plugin android-support-library androidx


【解决方案1】:

你同时使用了支持库和 androidx 库,你做不到。

检查 Firebase 库的 official release notes

-----------------------------------------------------------------
|  Service        |  Gradle dependency                           |
-----------------------------------------------------------------
| Firebase Core   | com.google.firebase:firebase-core:17.0.0     |
-----------------------------------------------------------------
| Cloud Messaging | com.google.firebase:firebase-messaging:19.0.0|
-----------------------------------------------------------------
| Authentication  | com.google.firebase:firebase-auth:18.0.0     |
-----------------------------------------------------------------

此版本是 主要 版本更新,包括重大更改。 在此版本中,库从 Android 支持库迁移到 Jetpack (AndroidX) 库。 除非您在应用中进行以下更改,否则更新后的库将不起作用:

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

【讨论】:

  • 我已迁移到 androidx,但出现此错误:error:package android.support.v7 does not exist
  • @zandroidarabapps 检查与错误相关的类。此包(和此导入)应仅与 androidx 库一起删除。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-08-08
  • 1970-01-01
  • 2019-11-19
  • 1970-01-01
  • 1970-01-01
  • 2019-11-02
相关资源
最近更新 更多