React-native: Manifest merger failed : Android

Created on 19 Jun 2019  路  31Comments  路  Source: facebook/react-native

Environment:
OS: Linux 4.15
Node: 8.15.0
Yarn: 1.12.3
npm: 6.4.1
Watchman: 4.7.0
Xcode: N/A
Android Studio: Not Found

Packages: (wanted => installed)
react: 16.3.1 => 16.3.1
react-native: 0.55.4 => 0.55.4

Steps to reproduce:

  1. react-native run-android
    2 gives me this error .
  • 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).
Bug Android Linux Locked

Most helpful comment

Add to your package level android/build.gradle in buildscript -> ext:

    googlePlayServicesVersion = "16.+"
    firebaseVersion = "17.6.0"

See:
https://github.com/facebook/react-native/issues/25173#issuecomment-503394795
https://github.com/facebook/react-native/issues/25296#issuecomment-503128993

All 31 comments

Refer to my comment here for the fix: https://github.com/facebook/react-native/issues/25296#issuecomment-503440779

+1 Same behavior

@udaisubramaniam did not work!

Refer to my comment here for the fix: #25296 (comment)

Fixed for me

because RN 0.60.0 suport androidx
and your module use RN 0.60.0
you can replace you build.gradle code '+' to '0.59.8' and
googlePlayServicesVersion = "15.0.1"
firebaseVersion = "17.6.0"
"react-native-camera": "^1.13.1"
See #25173 #25296

not clear what to do. @rocky225

Add to your package level android/build.gradle in buildscript -> ext:

    googlePlayServicesVersion = "16.+"
    firebaseVersion = "17.6.0"

See:
https://github.com/facebook/react-native/issues/25173#issuecomment-503394795
https://github.com/facebook/react-native/issues/25296#issuecomment-503128993

@fellmann Tried that too . still the same error.

Same issue

Same issue. All solutions listed above do not work for me.

@fellmann thanks a lot!
this error troubled me...and add these code to android/build.gradle,block 'buildscript'
ext { googlePlayServicesVersion = "16.+" firebaseVersion = "17.6.0" }
it's works!

Same issue. All solutions listed above do not work for me.

Add to your package level android/build.gradle in buildscript -> ext:

    googlePlayServicesVersion = "16.+"
    firebaseVersion = "17.6.0"

thanks @fellmann
adding just googlePlayServicesVersion = "16.+" worked fine for me

@nahidmbstu
Because not only 1 lib you are using relating to Google service.
you should try this " https://github.com/facebook/react-native/issues/25301#issuecomment-503330675 "
after you try above
If you found something cool like react-native-push-notification, react-native-device-info or something like that
add for that look like below

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

implementation (project(':react-native-push-notification'), {
        exclude group: "com.google.android.gms"
        exclude group: "com.google.firebase"
    })

don't forget

ext { googlePlayServicesVersion = "16.+" firebaseVersion = "17.6.0" }

This problem come from Google and burning out for 1 days

@fellmann Solution works. Thanks! I just waste few hours of researching this bug :/

@songoten28 thanks mate, you are a star.

I will suggest to strict type the following packages as recent google services updated caused a lot of conflicts in dependencies:
implementation(project(':react-native-maps')) { exclude group: 'com.google.android.gms', module: 'play-services-base' exclude group: 'com.google.android.gms', module: 'play-services-maps' } implementation(project(":react-native-device-info"), { exclude group: "com.google.android.gms" }) implementation 'com.google.firebase:firebase-core:16.0.1' implementation 'com.google.firebase:firebase-messaging:17.0.0' implementation 'com.google.android.gms:play-services-base:16.0.0' implementation 'com.google.android.gms:play-services-maps:16.0.0' implementation 'com.google.android.gms:play-services-gcm:16.0.0'
Check if you are using any of these libraries and specify the versions instead of using '+'

The same issue, feeling that React native is broken. It all depends on how many packages you added to your project. The community does not maintain some packages. So it will break.

Refer to my comment here for the fix: #25296 (comment)

Fixed for me as well

For me, it was react-native-admob, had to change its google play ad service dependency version to

implementation 'com.google.android.gms:play-services-ads:16+'

@nahidmbstu

The same issue, feeling that React native is broken. It all depends on how many packages you added to your project. The community does not maintain some packages. So it will break.

your project's build.gradle
the modules has build.gradle file too
all build.gradle must replace

i am getting same error
AAPT: No resource identifier found for attribute 'appCompon
entFactory' in package 'android'

i changed googlePlayServicesVersion = '+' to googlePlayServicesVersion = '16.+'

what should i do
this is my build.gradle
ext {
googlePlayServicesVersion = '16.+'
buildToolsVersion = "27.0.3"
minSdkVersion = 16
compileSdkVersion = 27
targetSdkVersion = 26
supportLibVersion = "27.1.0"
}

and my dependencies :

dependencies {
compile project(':react-native-image-crop-picker')
//compile project(':react-native-facebook-account-kit')
compile project(':react-native-youtube')
compile project(':react-native-vector-icons')
compile project(':react-native-compress-image')
compile project(':lottie-react-native')
compile project(':react-native-gesture-handler')
compile project(':react-native-image-picker')
compile project(':react-native-fbads')
compile project(':react-native-admob')
compile project(':react-native-share')
compile project(':react-native-android-permissions')
compile project(':react-native-view-shot')
compile project(':react-native-image-resizer')
compile project(':react-native-fs')
compile 'com.facebook.fresco:fresco:1.8.1'
compile 'com.facebook.fresco:animated-gif:1.8.1'
// For WebP support, including animated WebP
compile 'com.facebook.fresco:animated-webp:1.3.0'
compile 'com.facebook.fresco:webpsupport:1.3.0'
// For WebP support, without animations
compile 'com.facebook.fresco:webpsupport:1.3.0'
compile project(':react-native-fetch-blob')
compile project(':react-native-svg')
compile project(':react-native-fbsdk')
compile project(':react-native-linear-gradient')
compile fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation ("com.android.support:support-v4:${rootProject.ext.supportLibVersion}")
implementation ("com.android.support:design:${rootProject.ext.supportLibVersion}")
compile 'com.google.android.gms:play-services-ads:16.0.0'
compile "com.facebook.react:react-native:+" // From node_modules
compile 'com.google.android.gms:play-services-auth:+' // should be at least 9.0.0
implementation (project(':react-native-facebook-account-kit')) {
exclude group: "com.android.support"
}
}

@ppv94

@nahidmbstu take a look at react-native-community/react-native-device-info#693 (comment). Using that, try to find which libraries from androidX is your project using and then add those libraries to the code below
configurations.all { resolutionStrategy.force ' ' } in android/build.gradle

modify your graddle.properties
android.enableJetifier=true
android.useAndroidX=true
use jetifier
npm install --save-dev jetifier (or use yarn, but install it locally in your project, not globally)
npx jetify or npx jetify -w=1 (to specify the number of parallel workers)
npx react-native run-android

There is a simple solution to fix this error (its worked for me)

Step 1:
Download Android Studio (Latest version, 3.4.1 or greater) & Open your android project in Android Studio.

Step 2:
Right Click on the app folder > Refactor > Migrate to AndroidX & click on migrate.
Screenshot 2019-06-23 at 6 40 40 PM

Step 3:
After migration, a Dialogue box appears, proceed with Do Refactor

It will give android X support for your project.

25296 (comment)

it works for me!

I had the same issue and took me headache one day and a half.
Finally, I fixed this problem by just changing the version of Google Play Service.
See Release Notes of Google play service.

In android/app/build.gradle:

Screen Shot 2562-06-26 at 9 50 29 AM

In my case i'm using play-services-base and play-services-maps.

Change all com.google.android.gms:play-services-* dependencies to version 16.+

    implementation 'com.google.android.gms:play-services-base:16.+'
    implementation 'com.google.android.gms:play-services-maps:16.+'

In android/build.gradle:

Screen Shot 2562-06-26 at 10 13 40 AM

Add ext { googlePlayServicesVersion = "16.+" } to buildscript.

Re-Build project then everything works fine!!!

Ran into the same problem and fixed it by doing the following:

  1. Go into gradle.properties file and add this to the code:
    android.useAndroidX=true android.enableJetifier=true

  2. Run npm install --save-dev jetifier

  3. Run npx jetify
  4. Run npx react-native run-android to start your app

Adding
googlePlayServicesVersion = "16.+" and firebaseVersion = "17.6.0" to gradle's ext did NOT work for me.

I then tried @codedadysolutions's comment and migrated to AndroidX. It got rid of compile errors and got to compile, but in runtime I get:

2019-06-27 13:56:55.945 3166-3800/com.test E/SoLoader: Error when loading lib: dlopen failed: library "libjsc.so" not found lib hash: 9f147276937ca9f5dfbf5ff8b8b470c1 search path is /data/app/com.test-jaW81HQ65ONHL6Qdo2O7fA==/lib/x86
2019-06-27 13:56:55.945 3166-3800/com.test E/SoLoader: couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed: library "libjsc.so" not found

    --------- beginning of crash
2019-06-27 13:56:55.947 3166-3800/com.test E/AndroidRuntime: FATAL EXCEPTION: create_react_context
    Process: com.test, PID: 3166
    java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed: library "libjsc.so" not found
        at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:738)
        at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:591)
        at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:529)
        at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:484)
        at com.facebook.react.jscexecutor.JSCExecutor.<clinit>(JSCExecutor.java:19)
        at com.facebook.react.jscexecutor.JSCExecutorFactory.create(JSCExecutorFactory.java:29)
        at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:949)
        at java.lang.Thread.run(Thread.java:764)

This is a fresh new project with RN 0.60 RC2

@canpoyrazoglu add your config like this
app build.gradle

defaultConfig {
        ndk {
          abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
        }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
        }
    }
dependencies {
    implementation "org.webkit:android-jsc-intl:+"
}

This is a duplicate of #25293, please read the issue there to understand your problem. It's not strictly caused by the main react-native library itself.

Was this page helpful?
0 / 5 - 0 ratings