react-native-push-notification: The library enforces androidX, which crashes every react-native app
This library depends on the latest of com.google.android.gms and com.google.firebase:firebase-messaging which on their turn have been updated to use androidx libraries. Since React-Native is not yet ready for AndroidX (currently on RC). Using this library crashes every build of your app. The solution would be to not use latest as dependencies in build.gradle for this project. Our for every project that uses this project define this in buildscript { ext { … } }:
googlePlayServicesVersion = "16.0.0"
firebaseVersion = "17.0.0"
` 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). Suggestion: add ‘tools:replace=“android:appComponentFactory”’ to <application> element at AndroidManifest.xml:7:5-138 to override. `
The dependencies for react-native-push-notification:
+--- 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
| | | +--- androidx.annotation:annotation:1.0.0
| | | +--- androidx.core:core:1.0.0 (*)
| | | +--- androidx.documentfile:documentfile:1.0.0
| | | | \--- androidx.annotation:annotation:1.0.0
| | | +--- androidx.loader:loader:1.0.0
| | | | +--- androidx.annotation:annotation:1.0.0
| | | | +--- androidx.core:core:1.0.0 (*)
| | | | +--- androidx.lifecycle:lifecycle-livedata:2.0.0
| | | | | +--- androidx.arch.core:core-runtime:2.0.0
| | | | | | +--- androidx.annotation:annotation:1.0.0
| | | | | | \--- androidx.arch.core:core-common:2.0.0 (*)
| | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.0.0
| | | | | | +--- androidx.lifecycle:lifecycle-common:2.0.0 (*)
| | | | | | +--- androidx.arch.core:core-common:2.0.0 (*)
| | | | | | \--- androidx.arch.core:core-runtime:2.0.0 (*)
| | | | | \--- androidx.arch.core:core-common:2.0.0 (*)
| | | | \--- androidx.lifecycle:lifecycle-viewmodel:2.0.0
| | | | \--- androidx.annotation:annotation:1.0.0
| | | +--- androidx.localbroadcastmanager:localbroadcastmanager:1.0.0
| | | | \--- androidx.annotation:annotation:1.0.0
| | | \--- androidx.print:print:1.0.0
| | | \--- androidx.annotation:annotation:1.0.0
| | +--- com.google.android.gms:play-services-base:17.0.0
| | | +--- androidx.collection:collection:1.0.0 (*)
| | | +--- androidx.core:core:1.0.0 (*)
| | | +--- androidx.fragment:fragment:1.0.0
| | | | +--- androidx.core:core:1.0.0 (*)
| | | | +--- androidx.legacy:legacy-support-core-ui:1.0.0
| | | | | +--- androidx.annotation:annotation:1.0.0
| | | | | +--- androidx.core:core:1.0.0 (*)
| | | | | +--- androidx.legacy:legacy-support-core-utils:1.0.0 (*)
| | | | | +--- androidx.customview:customview:1.0.0
| | | | | | +--- androidx.annotation:annotation:1.0.0
| | | | | | \--- androidx.core:core:1.0.0 (*)
| | | | | +--- androidx.viewpager:viewpager:1.0.0
| | | | | | +--- androidx.annotation:annotation:1.0.0
| | | | | | +--- androidx.core:core:1.0.0 (*)
| | | | | | \--- androidx.customview:customview:1.0.0 (*)
| | | | | +--- androidx.coordinatorlayout:coordinatorlayout:1.0.0
| | | | | | +--- androidx.annotation:annotation:1.0.0
| | | | | | +--- androidx.core:core:1.0.0 (*)
| | | | | | \--- androidx.customview:customview:1.0.0 (*)
| | | | | +--- androidx.drawerlayout:drawerlayout:1.0.0
| | | | | | +--- androidx.annotation:annotation:1.0.0
| | | | | | +--- androidx.core:core:1.0.0 (*)
| | | | | | \--- androidx.customview:customview:1.0.0 (*)
| | | | | +--- androidx.slidingpanelayout:slidingpanelayout:1.0.0
| | | | | | +--- androidx.annotation:annotation:1.0.0
| | | | | | +--- androidx.core:core:1.0.0 (*)
| | | | | | \--- androidx.customview:customview:1.0.0 (*)
| | | | | +--- androidx.interpolator:interpolator:1.0.0
| | | | | | \--- androidx.annotation:annotation:1.0.0
| | | | | +--- androidx.swiperefreshlayout:swiperefreshlayout:1.0.0
| | | | | | +--- androidx.annotation:annotation:1.0.0
| | | | | | +--- androidx.core:core:1.0.0 (*)
| | | | | | \--- androidx.interpolator:interpolator:1.0.0 (*)
| | | | | +--- androidx.asynclayoutinflater:asynclayoutinflater:1.0.0
| | | | | | +--- androidx.annotation:annotation:1.0.0
| | | | | | \--- androidx.core:core:1.0.0 (*)
| | | | | \--- androidx.cursoradapter:cursoradapter:1.0.0
| | | | | \--- androidx.annotation:annotation:1.0.0
| | | | +--- androidx.legacy:legacy-support-core-utils:1.0.0 (*)
| | | | +--- androidx.annotation:annotation:1.0.0
| | | | +--- androidx.loader:loader:1.0.0 (*)
| | | | \--- androidx.lifecycle:lifecycle-viewmodel:2.0.0 (*)
| | | +--- com.google.android.gms:play-services-basement:17.0.0
| | | | +--- androidx.collection:collection:1.0.0 (*)
| | | | +--- androidx.core:core:1.0.0 (*)
| | | | \--- androidx.fragment:fragment:1.0.0 (*)
| | | \--- com.google.android.gms:play-services-tasks:17.0.0
| | | \--- com.google.android.gms:play-services-basement:17.0.0 (*)
| | +--- com.google.android.gms:play-services-basement:17.0.0 (*)
| | +--- com.google.android.gms:play-services-iid:[17.0.0] -> 17.0.0
| | | +--- androidx.collection:collection:1.0.0 (*)
| | | +--- androidx.core:core:1.0.0 (*)
| | | +--- com.google.android.gms:play-services-base:17.0.0 (*)
| | | +--- com.google.android.gms:play-services-basement:17.0.0 (*)
| | | +--- com.google.android.gms:play-services-stats:17.0.0
| | | | +--- androidx.legacy:legacy-support-core-utils:1.0.0 (*)
| | | | \--- com.google.android.gms:play-services-basement:17.0.0 (*)
| | | \--- com.google.android.gms:play-services-tasks:17.0.0 (*)
| | \--- com.google.android.gms:play-services-stats:17.0.0 (*)
| +--- me.leolin:ShortcutBadger:1.1.8
| \--- com.google.firebase:firebase-messaging:+ -> 19.0.0
| +--- androidx.collection:collection:1.0.0 (*)
| +--- androidx.core:core:1.0.0 (*)
| +--- com.google.android.gms:play-services-basement:17.0.0 (*)
| +--- com.google.android.gms:play-services-tasks:17.0.0 (*)
| +--- com.google.firebase:firebase-common:18.0.0
| | +--- androidx.annotation:annotation:1.0.0
| | +--- androidx.collection:collection:1.0.0 (*)
| | +--- androidx.core:core:1.0.0 (*)
| | +--- com.google.android.gms:play-services-basement:17.0.0 (*)
| | +--- com.google.android.gms:play-services-tasks:17.0.0 (*)
| | \--- com.google.auto.value:auto-value-annotations:1.6.3
| +--- com.google.firebase:firebase-iid:[19.0.0] -> 19.0.0
| | +--- androidx.collection:collection:1.0.0 (*)
| | +--- androidx.core:core:1.0.0 (*)
| | +--- androidx.legacy:legacy-support-core-utils:1.0.0 (*)
| | +--- com.google.android.gms:play-services-basement:17.0.0 (*)
| | +--- com.google.android.gms:play-services-stats:17.0.0 (*)
| | +--- com.google.android.gms:play-services-tasks:17.0.0 (*)
| | +--- com.google.firebase:firebase-common:18.0.0 (*)
| | \--- com.google.firebase:firebase-iid-interop:17.0.0
| | +--- com.google.android.gms:play-services-base:17.0.0 (*)
| | \--- com.google.android.gms:play-services-basement:17.0.0 (*)
| \--- com.google.firebase:firebase-measurement-connector:18.0.0
| \--- com.google.android.gms:play-services-basement:17.0.0 (*)
Just to clearify: I solved this issue by targeting the the googlePlayServicesVersion and firebaseVersion in build.gradle:
buildscript {
ext {
//buildToolsVersions, sdk version, etc
googlePlayServicesVersion = "16.0.0"
firebaseVersion = "17.0.0"
}
//repositories and dependencies
}
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 8
- Comments: 15 (1 by maintainers)
This is a shit update
Hey everybody. I solved the issue updating the build.gradle as follows:
Replace the
implementation project(":react-native-push-notification")section with:The issue is caused because react-native-push-notifications is using
com.google.android.gms:play-services-gcm:+that apparently was updated recently with breaking changes.More info on this issue
https://github.com/zo0r/react-native-push-notification/pull/1092 PR already out to fix it.
Wow, I can’t imagine having a project consistently working without any curiosity - because yes there are many errors, but I’m not replying to debate on that. Do what you need with priorities. Just saying that AndroidX really is inevitable. You must schedule some time eventually to ingest the change from react-native 0.59 to 0.60, and move to AndroidX. Whether it seems interesting or useful at the moment or not. This one is a big deal.
This site can help get you through the transitions, I recommend looking at the diff between each single version and applying them then making sure things still work: https://react-native-community.github.io/upgrade-helper/
As an example why, older versions of this might work, but then “that” (for a concrete example: firebase performance SDK on iOS13) needs an update to fix a crash bug, but it’s tied to firebase cloud messaging at a modern version, which means the react-native module that uses it needs a modern version, which pulls in the modern (AndroidX) versions on the Android side, and…there you go. Can be avoided for a while but if it’s not on the roadmap when you can do it without being under pressure, eventually it will become a hard requirement under a lot of pressure. But as ever and sincerely, I just want success for everyone’s projects.