web-dev-qa-db-ja.com

Firebase Coreバージョン17.0.0を追加した後、マニフェストのマージが失敗しました

Firebase crashlyticsの依存関係をプロジェクトに追加した後、プロジェクトがビルドされません。

https://firebase.google.com/docs/crashlytics/get-started?authuser=0&platform=Android#android

私が間違っている可能性があることについて提案してください。

ありがとう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"
        }
    }
}

Gradleプロパティ:

Android.useDeprecatedNdk=true
Android.enableAapt2=false
Android.useAndroidX=false
Android.enableJetifier=false
11
BRDroid
1. issue looks to be because of using same support library from two classes.         
-  (Android.support.v4.app.CoreComponentFactory) from [com.Android.support:support-compat:28.0.0]  
- (androidx.core.app.CoreComponentFactory) from [androidx.core:core:1.0.0] .

2. If possible remove the library which is including Android support libraries; check using 'gradlew dependencies'.

3. Or use androidx support libraries only remove libraries like 
   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"

  any specific reason you are using 'compile' instead of 'implementation'?

4. or make change suggested by error dump Suggestion: add 'tools:replace="Android:appComponentFactory"' to <application> element
1
Ranjan Kumar