React-native: URGENT :Unable to build

Created on 18 Jun 2019  路  17Comments  路  Source: facebook/react-native

While compiling the source code of reactnative we are getting following error:

Task :app:processDebugManifest FAILED
/Users/travash/Rayudu/Projects/NewNCC/android/app/src/main/AndroidManifest.xml:22:18-86 Error:
Attribute application@appComponentFactory value=(androidx.core.app.CoreComponentFactory) from [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86
is also present at [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91 value=(android.support.v4.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to element at AndroidManifest.xml:26:5-77:19 to override.

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

FAILURE: Build failed with an exception.

Please assist in solving this issue.

Bug Ran Commands Locked

Most helpful comment

Adding these 2 lines to the project level build.gradle saved my life:

buildscript {
    ext {
        ...
        googlePlayServicesVersion = "16.+"
        firebaseVersion = "17.3.4"
    }

Thanks @mhkhung.

I didn't figured out the big picture here but my guess is that some plugin in my project has an infamous "+" Firebase version as dependency that screwed up everything...

All 17 comments


Thanks for submitting your issue. Can you take another look at your description and make sure the issue template has been filled in its entirety?

馃憠 Click here if you want to take another look at the Bug Report issue template.

I have also. Previously the project worked fine. I cleared cache and reinstall all packages and it didn't help.

React Native Environment Info:
System:
OS: macOS 10.14.5
CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Memory: 1.83 GB / 16.00 GB
Shell: 3.0.2 - /usr/local/bin/fish
Binaries:
Node: 12.4.0 - /usr/local/bin/node
Yarn: 1.16.0 - /usr/local/bin/yarn
npm: 6.9.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
IDEs:
Android Studio: 3.3 AI-182.5107.16.33.5314842
Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.6 => 16.8.6
react-native: 0.59.8 => 0.59.8
npmGlobalPackages:
react-native-cli: 2.0.1

Since yesterday I've been have this issue, I bet that it has something to do with AndroidX and the new support library versioning scheme. Can't make it work yet, though.

I found a solution for my case. This was due to update Google Play Services and Firebase I changed versions to previous and it works:
googlePlayServicesVersion = "16.1.0"
firebaseVersion = "17.6.0"

For me it was around:

  1. cd into android and run ./gradlew app:dependencies
  2. Override any denpendencies with androidx stuff under it with the previous version
    example:
    In the app/build.gradle:
configurations.all {
    resolutionStrategy.force 'com.google.android.gms:play-services-base:16.1.0', 'com.google.android.gms:play-services-basement:16.2.0', 'com.google.android.gms:play-services-stats:16.0.1'
}

These lines alone fixed it in my case.

I found a solution for my case. This was due to update Google Play Services and Firebase I changed versions to previous and it works:
googlePlayServicesVersion = "16.1.0"
firebaseVersion = "17.6.0"

Yep this finally resolved my issue also! Seems like this error was caused by mixing AndroidX with the older com.support.* libraries. More specifically Google Play and Firebase

\--- com.google.firebase:firebase-messaging:+ -> 19.0.0
|         +--- androidx.collection:collection:1.0.0 (*)
|         +--- androidx.core:core:1.0.0 (*)
...
+--- project :react-native-push-notification
|    +--- com.android.support:appcompat-v7:28.0.0 (*)
|    +--- com.facebook.react:react-native:+ -> 0.59.9 (*)
|    +--- com.google.android.gms:play-services-gcm:+ -> 17.0.0
|    |    +--- androidx.collection:collection:1.0.0
|    |    |    \--- androidx.annotation:annotation:1.0.0
|    |    +--- androidx.core:core:1.0.0
|    |    |    +--- androidx.annotation:annotation:1.0.0
|    |    |    +--- androidx.collection:collection:1.0.0 (*)
|    |    |    +--- androidx.lifecycle:lifecycle-runtime:2.0.0
|    |    |    |    +--- androidx.lifecycle:lifecycle-common:2.0.0
|    |    |    |    |    \--- androidx.annotation:annotation:1.0.0
|    |    |    |    +--- androidx.arch.core:core-common:2.0.0
|    |    |    |    |    \--- androidx.annotation:annotation:1.0.0
|    |    |    |    \--- androidx.annotation:annotation:1.0.0
|    |    |    \--- androidx.versionedparcelable:versionedparcelable:1.0.0
|    |    |         +--- androidx.annotation:annotation:1.0.0
|    |    |         \--- androidx.collection:collection:1.0.0 (*)
|    |    +--- androidx.legacy:legacy-support-core-utils:1.0.0

For those looking, add the following to your gradle.properties then clean/rebuild

googlePlayServicesVersion=16.1.0
firebaseVersion=17.6.0

I also upgraded Gradle to 3.4.0 in build.gradle and 5.4.1 in gradle-wrapper.properties in accordance with RN v0.59.9.

After 2 full days.. I got my RN 0.55.2 project to work by:
android/app/build.gradle:

    implementation "com.google.android.gms:play-services-auth:16.0.1"
    implementation "com.google.android.gms:play-services-base:16.0.1"
    implementation(project(":react-native-device-info"),  {
      exclude group: "com.google.android.gms"
    })
    implementation "com.google.android.gms:play-services-gcm:16.0.0"
    implementation(project(":react-native-push-notification"),  {
        exclude group: "com.google.android.gms"
        exclude group: "com.google.firebase"
    })
    implementation(project(":react-native-google-analytics-bridge"),  {
      exclude group: "com.google.android.gms"
    })
    implementation(project(":react-native-google-signin"),  {
      exclude group: "com.google.android.gms"
    })
    implementation "com.google.android.gms:play-services-analytics:16.0.8"

and to android/build.gradle:

buildscript {
    ext {
        googlePlayServicesVersion = "16.+"
        firebaseVersion = "17.3.4"
    }
        resolutionStrategy {
            force "com.google.android.gms:play-services-basement:16.0.1"
            force "com.google.android.gms:play-services-base:16.0.1"
            force "com.google.android.gms:play-services-stats:16.0.1"
            force "com.google.android.gms:play-services-gcm:16.0.0"
        }

Adding these 2 lines to the project level build.gradle saved my life:

buildscript {
    ext {
        ...
        googlePlayServicesVersion = "16.+"
        firebaseVersion = "17.3.4"
    }

Thanks @mhkhung.

I didn't figured out the big picture here but my guess is that some plugin in my project has an infamous "+" Firebase version as dependency that screwed up everything...

Duplicate of #25173

I am sure 100s of teams world-wide are burning out last 2 days from this Google problem. #25173 has the right directions but not the full solution. Essentially you will need to keep doing
./gradlew cleanBuildCache && ./gradlew clean && ./gradlew app:dependencies
until you get rid of all the androidx in the dependencies output.

Good luck!

I found a solution for my case. This was due to update Google Play Services and Firebase I changed versions to previous and it works:
googlePlayServicesVersion = "16.1.0"
firebaseVersion = "17.6.0"

This solved my issue :)

I found a solution for my case. This was due to update Google Play Services and Firebase I changed versions to previous and it works:
googlePlayServicesVersion = "16.1.0"
firebaseVersion = "17.6.0"

I had to add it to the before-plugins.grade

dependencies {

project.ext {
    googlePlayServicesVersion = "16.1.0"    
    firebaseVersion = "17.6.0"
}
configurations.all {

    compile 'com.google.firebase:firebase-crash:9.4.0'        
   and so on....

I found a solution for my case. This was due to update Google Play Services and Firebase I changed versions to previous and it works:
googlePlayServicesVersion = "16.1.0"
firebaseVersion = "17.6.0"

Thanks. You save my life 馃憤 .
========= ========= ========= ========= =========
Put it into build.gradle
========= ========= ========= ========= =========
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
googlePlayServicesVersion = "16.+"
firebaseVersion = "17.6.0"

}
}
========= ========= ========= ========= =========

thanks a lot guys, you are the best!

I was using the node module react-native-device-info, just had to change my dependency in build.gradle to

implementation(project(":react-native-device-info"),  {
  exclude group: "com.google.android.gms"
})

Adding these 2 lines to the project level build.gradle saved my life:

buildscript {
    ext {
        ...
        googlePlayServicesVersion = "16.+"
        firebaseVersion = "17.3.4"
    }

Thanks @mhkhung.

I didn't figured out the big picture here but my guess is that some plugin in my project has an infamous "+" Firebase version as dependency that screwed up everything...

Absolute Working :)

Thank's @rhamretskyi! You just saved my life! It works like a charm :D

Was this page helpful?
0 / 5 - 0 ratings