清单合并失败:属性application @ appComponentFactory value =(android.support.v4.app.CoreComponentFactory

时间:2019-06-20 23:23:33

标签: android firebase android-gradle

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

1 个答案:

答案 0 :(得分: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中的说明进行操作。