1 year ago

#308735

test-img

lannyf

android, gradle, how to force to use a old com.google.firebase:firebase-messaging: dependence version

Having dependency in the app

api 'com.google.firebase:firebase-messaging:20.0.1'

But the app has dependency on other sdk, which depends on new version

api 'com.google.firebase:firebase-messaging:21.1.0'

and the app is not ready for 21.1.0 (got task.exception = java.io.IOException: FIS_AUTH_ERROR on

FirebaseInstanceId.getInstance().instanceId
                    .addOnCompleteListener(OnCompleteListener { task -> ...task.exception }

So would like to force to use 20.0.1.

and tried

configurations.all {
    resolutionStrategy {
        force 'com.google.firebase:firebase-messaging:20.0.1'
    }
}

it does not work, and tried (hope the group==com.google.firebase and name ==firebase-messaging are used correctly):

configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.google.firebase' && requested.name == 'firebase-messaging') {
            details.useVersion '20.0.1'
        }
    }
}

still it resolved to the newer 21.1.0:

enter image description here

and also see in the top level it has {strictly}, not sure where it is from: enter image description here

android

firebase

gradle

dependencies

gradle-dependencies

0 Answers

Your Answer

Accepted video resources