question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The library enforces androidX, which crashes every react-native app

See original GitHub issue

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
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:8
  • Comments:15 (1 by maintainers)

github_iconTop GitHub Comments

10reactions
zhangjunhoucommented, Jun 25, 2019

This is a shit update

5reactions
amerilescommented, Jun 19, 2019

Hey everybody. I solved the issue updating the build.gradle as follows:

Replace the implementation project(":react-native-push-notification") section with:

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

implementation "com.google.android.gms:play-services-gcm:16.0.0"

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to disagnose why React Native app crashes only on ...
Running any react-native command now yields the same result: > npx react-native run-android variant=release error Failed to load configuration ...
Read more >
Crashes | Android Developers
An app that is written using Java or Kotlin crashes if it throws an unhandled exception, represented by the Throwable class.
Read more >
react-native-screens - npm
On Android the View state is not persisted consistently across Activity restarts, which can lead to crashes in those cases. It is recommended...
Read more >
Using Hermes - React Native
Edit your android/app/gradle.properties file and make sure hermesEnabled is true: # Use this property to enable or disable the Hermes JS engine.
Read more >
Blue Cedar Accelerator for Microsoft 4.9.x Release Notes
Resolved issues What's new in Mobile Client 4.9.9 Android minSdkVersion for Enforce, Microsoft Upgraded the mobile client to support Android SDK mi...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found