Android 添加Firebase核心版本17.0.0后,清单合并失败

Android 添加Firebase核心版本17.0.0后,清单合并失败,android,firebase,react-native,android-gradle-plugin,crashlytics,Android,Firebase,React Native,Android Gradle Plugin,Crashlytics,我将firebase crashlytics依赖项添加到我的项目中,之后项目不会生成 你能建议一下我可能做错了什么吗 谢谢 R 构建在这些行上失败 implementation "com.google.android.gms:play-services-base:17.0.0" implementation 'com.google.firebase:firebase-core:17.0.0' 这是错误日志 Task :app:processDebugManifest FAILED C:\De

我将firebase crashlytics依赖项添加到我的项目中,之后项目不会生成

你能建议一下我可能做错了什么吗

谢谢 R

构建在这些行上失败

implementation "com.google.android.gms:play-services-base:17.0.0"
implementation 'com.google.firebase:firebase-core:17.0.0'
这是错误日志

Task :app:processDebugManifest FAILED
C:\Development\xxx\xxx-app\android\app\src\main\AndroidManifest.xml:22:18-91 Error:
    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:7:5-35:19 to override.

See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> 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:7:5-35:19 to override.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
See https://docs.gradle.org/4.8/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 3s
72 actionable tasks: 70 executed, 2 up-to-date
Gradle:

dependencies {
    compile project(':react-native-vector-icons')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:28.0.0"
    compile "com.android.support:support-media-compat:28.0.0"
    compile "com.android.support:support-v4:28.0.0"
    compile "com.facebook.react:react-native:+"  // From node_modules
    compile project(':react-native-localization')
    compile project(':realm')
    compile project(':react-native-keychain')
    compile project(':react-native-device-info')
    compile project(':react-native-sensitive-info')
    compile project(':react-native-fs')
    implementation project(':react-native-firebase')
    implementation "com.google.android.gms:play-services-base:17.0.0"
    implementation 'com.google.firebase:firebase-core:17.0.0'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
    //compile project(':react-native-secure-key-store')
}
buildscript {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://maven.fabric.io/public'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'
        //classpath 'com.google.gms:google-services:3.0.0'
        classpath 'com.google.gms:google-services:4.2.0'
        classpath 'io.fabric.tools:gradle:1.29.0'  // Crashlytics plugin
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

ext {
    compileSdkVersion = 28
    buildToolsVersion = "28.0.0"
    minSdkVersion = 23
    targetSdkVersion = 28    
}

allprojects {
    repositories {
        mavenLocal()
        google()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
    }
}
android.useDeprecatedNdk=true
android.enableAapt2=false
android.useAndroidX=false
android.enableJetifier=false
渐变属性:

dependencies {
    compile project(':react-native-vector-icons')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:28.0.0"
    compile "com.android.support:support-media-compat:28.0.0"
    compile "com.android.support:support-v4:28.0.0"
    compile "com.facebook.react:react-native:+"  // From node_modules
    compile project(':react-native-localization')
    compile project(':realm')
    compile project(':react-native-keychain')
    compile project(':react-native-device-info')
    compile project(':react-native-sensitive-info')
    compile project(':react-native-fs')
    implementation project(':react-native-firebase')
    implementation "com.google.android.gms:play-services-base:17.0.0"
    implementation 'com.google.firebase:firebase-core:17.0.0'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
    //compile project(':react-native-secure-key-store')
}
buildscript {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://maven.fabric.io/public'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'
        //classpath 'com.google.gms:google-services:3.0.0'
        classpath 'com.google.gms:google-services:4.2.0'
        classpath 'io.fabric.tools:gradle:1.29.0'  // Crashlytics plugin
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

ext {
    compileSdkVersion = 28
    buildToolsVersion = "28.0.0"
    minSdkVersion = 23
    targetSdkVersion = 28    
}

allprojects {
    repositories {
        mavenLocal()
        google()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
    }
}
android.useDeprecatedNdk=true
android.enableAapt2=false
android.useAndroidX=false
android.enableJetifier=false

问题是最新的firebase依赖项已迁移到androidx。因此,一个修复方法是将您的项目迁移到androidx,请参阅(我更喜欢这样做,因为所有新的升级都使用androidx)。或者,您可以将firebase core依赖项降级到以下版本

implementation 'com.google.firebase:firebase-core:16.0.9'
1。问题似乎是因为使用了来自两个类的相同支持库。
-(android.support.v4.app.CoreComponentFactory)来自[com.android.support:support compat:28.0.0]
-(androidx.core.app.CoreComponentFactory)来自[androidx.core:core:1.0.0]。
2.如果可能,移除包含android支持库的库;使用“gradlew依赖项”进行检查。
3.或者使用androidx支持库仅删除类似的库
编译“com.android.support:appcompat-v7:28.0.0”
编译“com.android.support:support media compat:28.0.0”
编译“com.android.support:support-v4:28.0.0”
您使用“编译”而不是“实现”的具体原因是什么?
4.或者根据错误转储建议进行更改:将“tools:replace=“android:appComponentFactory”添加到元素

Hi应该更改com.google.android.gms的版本:play services base:17.0.0是的,您也必须对其进行降级,但请记住,我建议迁移到androidx在将来会更有帮助。降级对我来说很有效。我在上查看了每个firebase库,并选择了不高于2018年5月的最新版本。除了降低firebase,还有其他需要降级的内容吗?您必须降级所有使用Androidx的库。但是我强烈建议你去AndroidX有什么解决办法?@SeanMC,我研究这个问题已经很久了。请告诉我您面临的错误以及相应的详细信息(工具/环境的版本)。无需担心。我升级到androidx,它就消失了