Tools:replace="android:appComponentFactory Ошибка

Когда я пытаюсь запустить приложение, я получаю следующую ошибку. Что мне нужно сделать, чтобы решить эту проблему?

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 element at AndroidManifest.xml:9:5-31:19 to override.

See ... 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 element at AndroidManifest.xml:9:5-31:19 to override.

<?xml version = "1.0" encoding = "utf-8"?>
<manifest xmlns:android = "http://schemas.android.com/apk/res/android"
    package = "stechome.berkeylen.firebasedatabase">
    <uses-permission android:name = "android.permission.INTERNET"/>
    <uses-permission android:name = "android.permission.CAMERA" />
    <uses-permission android:name = "android.permission.FLASHLIGHT"/>
    <uses-feature android:name = "android.hardware.camera2" />

    <application
        android:allowBackup = "true"
        android:icon = "@mipmap/ic_launcher"
        android:label = "@string/app_name"
        android:roundIcon = "@mipmap/ic_launcher_round"
        android:supportsRtl = "true"
        android:theme = "@style/AppTheme">


        <activity android:name = ".MainActivity">
            <intent-filter>
                <action android:name = "android.intent.action.MAIN" />
                <category android:name = "android.intent.category.LAUNCHER" />
            </intent-filter>

        </activity>

        <activity android:name = ".RvActivity"/>
        <activity android:name = ".QRCodeScanner"/>
        <activity android:name = ".ContactActivity"/>
        <activity android:name = ".RoomsActivity"/>

    </application>

</manifest>
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'

    defaultConfig {
        applicationId "..."
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
configurations.all {
    resolutionStrategy.force 'com.android.support:support-v4:28.0.0'
    // the above lib may be old dependencies version
}
dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.google.firebase:firebase-core:16.0.9'
    implementation 'com.firebaseui:firebase-ui:0.4.3'
    implementation 'com.dlazaro66.qrcodereaderview:qrcodereaderview:2.0.3'
    implementation 'com.miomin:shswiperefreshlayout:1.3.0'
    implementation 'info.hoang8f:android-segmented:1.0.6'
    implementation 'me.dm7.barcodescanner:zxing:1.9'
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:28.0.0-rc01'

    implementation 'com.google.firebase:firebase-messaging:19.0.1'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.google.firebase:firebase-auth:17.0.0'
    compileOnly 'com.google.android.things:androidthings:0.7-devpreview'
    implementation 'com.google.firebase:firebase-database:17.0.0'
    // Required only if Facebook login support is required
    testİmplementation 'junit:junit:4.12'
    androidTestİmplementation 'com.android.support.test:runner:1.0.2'
    androidTestİmplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.android.support:mediarouter-v7:28.0.0'
}
3
0
5 806
4
Перейти к ответу Данный вопрос помечен как решенный

Ответы 4

Ответ принят как подходящий

Обновите свою библиотеку до AndroidX, перейдите в меню Refactor - перенесено на androidx.

Во Flutter Project я перенес проект на AndroidX, все заработало. Refactor->Migrate to AndroidX

Я использую флаттер, в моем случае обновления Gradle было более чем достаточно.

Шаги:

1- open android stodio

2- file -> open -> go your project -> select android folder inside it

3- wait until the sync finishes, it may take some time

4- you may find a popup - gradle upgrade on the righ down corner

5- clcik gradle upgrade and wait

В моем случае я уже использовал AndroidX, но с устаревшей библиотекой. Я зашел в файл gradle.properties и поставил строчку

android.enableJetifier=true

Другие вопросы по теме