React-native-push-notification: Android Manifest merge error

Created on 29 Jul 2019  路  14Comments  路  Source: zo0r/react-native-push-notification

Hello,

I am facing the following error:

Task :app:processDebugManifest FAILED
/Users/my-user/Documents/pushproject/android/app/src/debug/AndroidManifest.xml:22:18-91 Error:
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:7:5-117 to override.

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

My OS and settings are:
OS: Mac
Platform: Android
React Native version: 0.59.10
RN Push Notifications version: 3.1.3
Device: Moto G6 Android Pie(9.0)

Steps to reproduce:

  1. Install RN -v 0.59.10
  2. react-native run-android
  3. npm install --save react-native-push-notification
  4. react-native link react-native-push-notification
  5. Did not change the App.js. It was left untouched.
  6. react-native run-android
    There is when the error occurs. Note that I did not even started to use the RN push notification module. I just installed and linked it, then react-native run-android to see if everything still running ok, but it is not.
Stale

Most helpful comment

@mAlaliSy you saved me bro! after hours i finally could build my project but with a little bit more changes.

First: go to the 'node_modules\react-native-push-notification\androidbuild.gradle' and add these two lines:

def DEFAULT_GOOGLE_PLAY_SERVICES_VERSION = "+"
def DEFAULT_FIREBASE_MESSAGING_VERSION = "+"

then go to 'Your_project_folder\android\appbuild.gradle' and replace
implementation project('react-native-push-notification')
with

compile (project(':react-native-push-notification')) {
        exclude group: "com.google.android.gms", module: "play-services-gcm"
        exclude group: "com.google.firebase", module: "firebase-messaging"
 }

All 14 comments

i have same issue

I am also facing the same problem

Same issue here. I just tried upgrading to 0.59.9, and got this error

Mesmo erro aqui. Alguma solucao?

I have solved the problem by this solution. I have changed the build.gradle of the app to:

dependencies {
    compile (project(':react-native-push-notification')) {
        exclude group: "com.google.android.gms", module: "play-services-gcm"
        exclude group: "com.google.firebase", module: "firebase-messaging"
    }
    ...
}


Tried your solution @mAlaliSy, but it didn't help I'm afraid

  1. cd android directory
  2. open gradle.properties
  3. add these 2 lines:
    android.useAndroidX=true
    android.enableJetifier=true
  4. install jetifier with this command npm install --save-dev jetifier
  5. run npx jetify
  6. react-native run-android

It helped me.

@lgogs doesn't that solution only apply to RN >= 0.60, as there's no AndroidX support in RN 0.59.9?

@tommynordli There is no need for those steps RN >= 60, I followed them when I used 0.59.10 version.

After hours and hours and a lot of attempts, this is what worked so far.
In android/app/build.gradle use:
dependencies {
implementation(project(":react-native-push-notification"), {
exclude group: "com.google.android.gms" exclude group: "com.google.firebase" })
}

In android/build.gradle use:

ext{ ...
googlePlayServicesVersion = "16.0.0"
firebaseVersion = "17.3.4"
... }

@mAlaliSy you saved me bro! after hours i finally could build my project but with a little bit more changes.

First: go to the 'node_modules\react-native-push-notification\androidbuild.gradle' and add these two lines:

def DEFAULT_GOOGLE_PLAY_SERVICES_VERSION = "+"
def DEFAULT_FIREBASE_MESSAGING_VERSION = "+"

then go to 'Your_project_folder\android\appbuild.gradle' and replace
implementation project('react-native-push-notification')
with

compile (project(':react-native-push-notification')) {
        exclude group: "com.google.android.gms", module: "play-services-gcm"
        exclude group: "com.google.firebase", module: "firebase-messaging"
 }

@mAlaliSy you saved me bro! after hours i finally could build my project but with a little bit more changes.

First: go to the 'node_modules\react-native-push-notification\androidbuild.gradle' and add these two lines:

def DEFAULT_GOOGLE_PLAY_SERVICES_VERSION = "+"
def DEFAULT_FIREBASE_MESSAGING_VERSION = "+"

then go to 'Your_project_folder\android\appbuild.gradle' and replace
implementation project('react-native-push-notification')
with

compile (project(':react-native-push-notification')) {
        exclude group: "com.google.android.gms", module: "play-services-gcm"
        exclude group: "com.google.firebase", module: "firebase-messaging"
 }

My program close, you gone help me?

After hours and hours and a lot of attempts, this is what worked so far.
In android/app/build.gradle use:
dependencies {
implementation(project(":react-native-push-notification"), {
exclude group: "com.google.android.gms" exclude group: "com.google.firebase" })
}

In android/build.gradle use:

ext{ ...
googlePlayServicesVersion = "16.0.0"
firebaseVersion = "17.3.4"
... }

try this it work for me
ext{ ...
googlePlayServicesVersion = "+"
firebaseVersion = "+"
... }

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cookienawer picture cookienawer  路  3Comments

ssolida picture ssolida  路  3Comments

ahmadallo1 picture ahmadallo1  路  3Comments

nguyenvanphuc2203 picture nguyenvanphuc2203  路  3Comments

Benzer1406 picture Benzer1406  路  3Comments