1

I am working on my app.Everything was ok but i do not know why i got this error when i tried to run the application:

Execution failed for task ':inteligentestate: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:6:5-28:19 to override.

from the error suggestion i added tools:replace="android:appComponentFactory" in my main application manifest:

<application
    android:name=".application.App"
    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"
    tools:ignore="GoogleAppIndexingWarning"
    tools:replace="android:appComponentFactory">

When i run my app i got this error:

Task :inteligentestate:processDebugManifest FAILED
/mnt/main/Project/.../AndroidManifest.xml:6:5-29:19 Error:
    tools:replace specified at line:6 for attribute android:appComponentFactory, but no new value specified
/mnt/main/Tutorial/Android/project/.../AndroidManifest.xml Error:
    Validation failed, exiting

I googled and I found this post . I'm not using androidX

This is my project dependencies:

dependencies {
    // Support
    implementation "com.android.support:design:${versions.supportLib}"
    implementation "com.android.support:recyclerview-v7:${versions.supportLib}"
    implementation "com.android.support:cardview-v7:${versions.supportLib}"
    implementation "com.android.support:gridlayout-v7:${versions.supportLib}"
    implementation "com.android.support:customtabs:${versions.supportLib}"

    // room
    implementation "android.arch.persistence.room:runtime:${versions.room}"
    annotationProcessor "android.arch.persistence.room:compiler:${versions.room}"
    implementation "android.arch.persistence.room:rxjava2:${versions.room}"

    // Network
    implementation "com.google.code.gson:gson:${versions.gson}"
    implementation "com.squareup.retrofit2:retrofit:${versions.retrofit}"
    implementation "com.squareup.retrofit2:converter-gson:${versions.retrofit}"
    implementation "com.squareup.okhttp3:logging-interceptor:${versions.interceptor}"

    //rx java
    implementation "io.reactivex.rxjava2:rxandroid:${versions.rxAndroidVersion}"
    implementation "io.reactivex.rxjava2:rxjava:${versions.rxJavaVersion}"

    //Other
    implementation "com.jakewharton.timber:timber:${versions.timber}"
    implementation "com.jakewharton:butterknife:${versions.butterknife}"
    annotationProcessor "com.jakewharton:butterknife-compiler:${versions.butterknife}"
    implementation "com.google.dagger:dagger:${versions.dagger}"
    annotationProcessor "com.google.dagger:dagger-compiler:${versions.dagger}"

    // Testing
    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 project(path: ':map')
}

And library dependancies:

dependencies {
    api fileTree(dir: 'libs', include: ['*.jar'])
    api "com.android.support.constraint:constraint-layout:${versions.constraintLayout}"
    api "com.android.support:appcompat-v7:${versions.supportLib}"
    api "com.android.support:support-v4:${versions.supportLib}"

    // Mapbox
    api "com.mapbox.mapboxsdk:mapbox-android-sdk:${versions.mapboxMapSdk}"
    api "com.mapbox.mapboxsdk:mapbox-android-plugin-localization-v7:${versions.mapboxPluginLocalization}"

I found this post anber mentioned that

project has different versions of the same library

But i think my project's library is the same!!!

griffins
  • 7,079
  • 4
  • 29
  • 54
Cyrus the Great
  • 5,145
  • 5
  • 68
  • 149

3 Answers3

1

Solution: Android Studio => Refactor Menu => Migrate to AndroidX.

Benjamin
  • 11
  • 1
0

Yes it's easy.

Go to your application manifest and at bottom you'll see mergedManifest option

navigate to mergedManifest bottom where it will tell your what you've error and in what file

See you error closer. It's mostly error in our layout file that's why merged Manifest don't works

Hope so it will solve your error!!!

Muhammad Ashfaq
  • 2,359
  • 5
  • 20
  • 46
-2

please try downgrade your gradle version and restart Android studio