【问题标题】:Error when Adding Firebase to Android App Manifest merger failed [duplicate]将 Firebase 添加到 Android App Manifest 合并失败时出错 [重复]
【发布时间】:2019-08-28 01:17:17
【问题描述】:

我正在我的应用程序上设置 Firebase,我已完成以下操作:

注册应用 下载 google-services.json 文件并插入我的 Android 应用模块根目录 修改了我的 Gradle 文件

但是,当我尝试与 Gradle 同步时,出现以下错误

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

当我在 Manifest 文件中插入 tools:replace="android:appComponentFactory" 时,出现以下错误

错误:清单合并失败并出现多个错误,请参阅日志

我似乎无法找到错误的原因或来源,因为我明智地遵循了 Android 设置教程并且没有犯任何错误

这是我的应用 Gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.ariellafitness"
        minSdkVersion 16
        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 'com.google.firebase:firebase-analytics:17.0.1'
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'co.paystack.android.design.widget:pinpad:1.0.1'
    implementation 'co.paystack.android:paystack:3.0.10'
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    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.android.support:design:28.0.0'
}

这是我的项目 Gradle 的一部分

buildscript {
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
        classpath 'com.google.gms:google-services:4.2.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

感谢您的帮助

【问题讨论】:

  • 你需要迁移到AndroidX
  • @Ticherhaz 感谢您的回复

标签: android firebase


【解决方案1】:

【讨论】:

    猜你喜欢
    • 2017-05-30
    • 2015-09-12
    • 2017-03-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-01-03
    • 1970-01-01
    相关资源
    最近更新 更多