facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
118.8k stars 24.29k forks source link

how to solve mainfest merger error? #25292

Closed ydv0121 closed 5 years ago

ydv0121 commented 5 years ago

got this error today to add the tools:replace in my mainfest

Screenshot 2019-06-18 at 10 46 28 AM

when i add tools:replace="android:appComponentFactory" to my mainfest file got another error -

Screenshot 2019-06-18 at 10 47 58 AM

don't understand how to resolve this?

Arun-paramasivam commented 5 years ago

In my case problem was produced by react-native-push-notification package (https://github.com/zo0r/react-native-push-notification/blob/master/android/build.gradle#L50).

It has com.google.firebase:firebase-messaging as dependency and it was upgraded from 18.0.0 -> 19.0.0. What produced adroidx injection as dependency.

Solution: add firebaseVersion=18.0.0 to your gradle.properties

thanks to @igordevelops i used similar solution. In android level build.gradle file (not which is inside app folder) i added these two lines:

buildscript { ext { buildToolsVersion = "28.0.2" minSdkVersion = 16 compileSdkVersion = 28 targetSdkVersion = 27 supportLibVersion = "28.0.0"

those resolved the dependency error and my app works. might help someone. I got this manifest merger error as i used react-native-push-notification package.

tatva-hiral commented 5 years ago

Issue fixed by using the installed latest version of react-native-google-signin and react-native push-notification and below configuration : ext{ googlePlayServicesAuthVersion = "15.0.1" googlePlayServicesVersion = "16.1.0" firebaseVersion = "17.5.0" } help

nolife08021 commented 5 years ago

i solved mine with these dependencies

implementation project(':react-native-firebase')
implementation(project(':react-native-push-notification')) {
    exclude group: 'com.google.android.gms'
}
implementation ("com.google.android.gms:play-services-gcm:16.1.0") {
    force = true
}
implementation ("com.google.android.gms:play-services-base:16.1.0") {
    force = true
}
implementation ("com.google.firebase:firebase-core:16.0.9") {
    force = true
}
implementation ("com.google.firebase:firebase-messaging:18.0.0") {
    force = true
}

@firehand33 thanks BRO!!!finally build success

hsa1280 commented 5 years ago

@JetCyC Thanks for the solution, it works for me.

mkamals commented 5 years ago

Thanks for this. It worked like charm.

Yathousen commented 5 years ago

I recently made an article to address this AndroidX situation, you may find it useful.

https://medium.com/@yathousen/the-day-google-decided-to-shake-the-react-native-community-4ba5cdd33388

zsubzwary commented 5 years ago

you can force google play service version in android> build.gradle file in ext like following

ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28
        supportLibVersion = "28.0.0"
        googlePlayServicesVersion = "16.0.0"
        googlePlayServicesVisionVersion = "17.0.2"
    }

my issue fixed :)

Thanks, wrote an article on this!! : https://medium.com/@zsubzwary/application-appcomponentfactory-issue-in-reactnative-project-possible-solution-3bc8afa97be?sk=201ea2c810de2c9199804aac06e17153

zsubzwary commented 5 years ago

Thanks, @Yathousen for the article that I cannot read because it isn't free to read !!

😭😭😓😓😭😭

Yathousen commented 5 years ago

Thanks, @Yathousen for the article that I cannot read because it isn't free to read !!

😭😭😓😓😭😭

Hi @zsubzwary, I'm sorry but that's weird, I'm not even part of the partner's program, are you sure you cannot read it? Could you share with us a screenshot?

zsubzwary commented 5 years ago

Hi @zsubzwary, I'm sorry but that's weird, I'm not even part of the partner's program, are you sure you cannot read it? Could you share with us a screenshot?

@Yathousen here you go... ScreenShot

alanmarcell commented 5 years ago
  1. Check if you have a library which depends on AndroidX:

cd android && ./gradlew app:dependencies

  • For me it was Google Play Services @ 18.0.0 which depends on AndroidX.
  1. Set Google Play Services to specific version number (check https://developers.google.com/android/guides/releases for the version you want to use): implementation "com.google.android.gms:play-services-maps:16.0.0"
  2. If a package uses a newer version (see 1.) of the Google Play Services libraries, just exclude it in your app's build.gradle:
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'
}
  1. Add attributes to <application> in your AndroidManifest.xml:
android:appComponentFactory="androidx"
tools:replace="android:appComponentFactory"
  1. Add config to settings.gradle:
android.useAndroidX=false
android.enableJetifier=false

I'm not too sure about 4. and 5. but it's working for me like this. Be sure to revert this stuff when you update to 0.60+ and AndroidX support is provided by all libraries you use.

As mentioned by @firehand33 it could be that you have to force the Google Play Services libraries versions, e.g.:

implementation ("com.google.android.gms:play-services-gcm:16.1.0") {
    force = true
}

Could you post your output when you executes step 1?

safciplak commented 4 years ago

buildToolsVersion = "28.0.3" minSdkVersion = 16 compileSdkVersion = 28 targetSdkVersion = 28 supportLibVersion = "28.0.0" googlePlayServicesVersion = "16.0.0" googlePlayServicesVisionVersion = "17.0.2"

https://stackoverflow.com/questions/36814755/sources-for-android-api-23-platform-not-found-android-studio-2-0/37283886#37283886