React-native-push-notification: Android Build Error : D8: Program type already present: android.support.v4.app.INotificationSideChannel$Stub$Proxy

Created on 18 Jun 2019  路  9Comments  路  Source: zo0r/react-native-push-notification

Suddenly I got this error .

D8: Program type already present: android.support.v4.app.INotificationSideChannel$Stub$Proxy

After I unlinked this module, the building finished successfully.
This module was linked when I had created the project a long time ago, and worked well till this morning.
I did nothing to configure the project.

React Native: 0.59.5,
React Native Push Notification : 3.1.3
buildToolsVersion = "28.0.3"
supportLibVersion = "28.0.0"
compileSdkVersion = 28

So I have migrated the project to AndroidX, then other modules were crashed.
How can fix this?

Most helpful comment

Hello ,
AndroidX has some conflicts with numerous package, including react-native-device-info, and react-native-push-notification

Below the build.gradle of this dependency, binding to last play-services-gcm version "+" :

implementation "com.google.android.gms:play-services gcm:${safeExtGet('googlePlayServicesVersion', '+')}"

solution working here :

Modify in build.gradle :

buildscript {
    ext {
        googlePlayServicesVersion = "16.+"
        firebaseVersion = "17.3.4"

and as a resolution :

configurations.all {
    resolutionStrategy {
        force "com.google.android.gms:play-services-basement:16.0.1"
        force "com.google.android.gms:play-services-base:16.0.1"
        force "com.google.android.gms:play-services-stats:16.0.1"
        force "com.google.android.gms:play-services-gcm:16.0.0"
    }
}

May need to run
cd android && gradlew clean

All 9 comments

Same there.

Same here !!!

upvote, same here too!

same here guys (

Ok I found this post #1091
I just follow this and it work like charm!
tltr: change this 2 value in your build.gradle

googlePlayServicesVersion = "16.1.0"  
firebaseVersion = "17.6.0" 

There are a bunch of older packages that would conflict with AndroidX, and since RN v0.60 is still in beta/RC, it's better to downgrade Google Play and Firebase.

Add this to your gradle.properties and update gradle if needed based on your react-native version.

googlePlayServicesVersion=16.1.0
firebaseVersion=17.6.0

details: https://github.com/facebook/react-native/issues/25301#issuecomment-503269743

Hello ,
AndroidX has some conflicts with numerous package, including react-native-device-info, and react-native-push-notification

Below the build.gradle of this dependency, binding to last play-services-gcm version "+" :

implementation "com.google.android.gms:play-services gcm:${safeExtGet('googlePlayServicesVersion', '+')}"

solution working here :

Modify in build.gradle :

buildscript {
    ext {
        googlePlayServicesVersion = "16.+"
        firebaseVersion = "17.3.4"

and as a resolution :

configurations.all {
    resolutionStrategy {
        force "com.google.android.gms:play-services-basement:16.0.1"
        force "com.google.android.gms:play-services-base:16.0.1"
        force "com.google.android.gms:play-services-stats:16.0.1"
        force "com.google.android.gms:play-services-gcm:16.0.0"
    }
}

May need to run
cd android && gradlew clean

Thank you @MonkeyMoneyFrance. That helped me resolve the issue i was having.

Thanks @MonkeyMoneyFrance you saved me.

Was this page helpful?
0 / 5 - 0 ratings