React-native-push-notification: gradle update for firebase iid

Created on 19 Sep 2018  路  6Comments  路  Source: zo0r/react-native-push-notification

If you currently have ignore firebase version you wont get this issue but
I got this issue from react-native-push-notification when updating my gradle files
The library com.google.firebase:firebase-iid is being requested by various other libraries at [[17.0.2,17.0.2]], but resolves to 16.2.0. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.

all that needs to be done is for the project to update it's build.gradle files

I'll submit a pr with the changes

Stale

Most helpful comment

UPDATE:

I solved my issue by forcing the resolution of firebase dependencies with the following code

allprojects {
    repositories {
        // Incredibly, Engineers at Google don't know how software versioning works!
        // If a new firebase package is published, then old ones cease to work, causing the app to
        // immediately crash. This forces gradle to use the versions we want
        // start here
        // https://github.com/invertase/react-native-firebase/issues/900
        configurations.all {
            resolutionStrategy {
                force 'com.google.android.gms:play-services-auth:16.0.0'
                force 'com.google.android.gms:play-services-base:15.0.1'
                force 'com.google.firebase:firebase-core:16.0.3'
                force 'com.google.firebase:firebase-auth:16.0.3'
                // Necessary for react-native-push-notification firebase dependency
                force 'com.google.firebase:firebase-iid:17.0.2' // <----- This is what I added
            }
        }
        // end

        mavenLocal()
        maven {url "https://maven.google.com"}
        google()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        maven { url "https://jitpack.io" }
        google()
    }
}

This should be in android/build.gradle (the topmost one, not the one in the app folder) and it should reside in allProjects.

Check under resolutionStrategy

All 6 comments

+1

@tonmanayo Can you detail what those changes are? I have the same problem, but I can't decipher what to change from your comment.

UPDATE:

I solved my issue by forcing the resolution of firebase dependencies with the following code

allprojects {
    repositories {
        // Incredibly, Engineers at Google don't know how software versioning works!
        // If a new firebase package is published, then old ones cease to work, causing the app to
        // immediately crash. This forces gradle to use the versions we want
        // start here
        // https://github.com/invertase/react-native-firebase/issues/900
        configurations.all {
            resolutionStrategy {
                force 'com.google.android.gms:play-services-auth:16.0.0'
                force 'com.google.android.gms:play-services-base:15.0.1'
                force 'com.google.firebase:firebase-core:16.0.3'
                force 'com.google.firebase:firebase-auth:16.0.3'
                // Necessary for react-native-push-notification firebase dependency
                force 'com.google.firebase:firebase-iid:17.0.2' // <----- This is what I added
            }
        }
        // end

        mavenLocal()
        maven {url "https://maven.google.com"}
        google()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        maven { url "https://jitpack.io" }
        google()
    }
}

This should be in android/build.gradle (the topmost one, not the one in the app folder) and it should reside in allProjects.

Check under resolutionStrategy

@awchang56 s there are a few solutions, you either change the actual node_modules react-native-push-notification lib gradle.build versions to be all the same in your project or you can add this to the bottom of your build.gradle file: GoogleServicesPlugin.config.disableVersionCheck = true
or your way seems to work too

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.

It's not. I think forcing some version on a library is bad practice

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cookienawer picture cookienawer  路  3Comments

nguyenvanphuc2203 picture nguyenvanphuc2203  路  3Comments

edwinharly picture edwinharly  路  3Comments

ssolida picture ssolida  路  3Comments

GastonEDiaz picture GastonEDiaz  路  3Comments