Ionic 4 Cordova - cordova-plugin-firebase-dynamiclinks Error Android build

I am creating iOS app using ionic4 and Cordova version 9.0.0. Whenever I am trying to install cordova-plugin-firebase-dynamiclinks plugin in my project and try to create Android build, it gives me following error :
Could not determine the dependencies of task ‘:app:compileDebugJavaWithJavac’.
> In project ‘app’ a resolved Google Play services library dependency depends on another at an exact version (e.g. "[18.0.
0]", but isn’t being resolved to that version. Behavior exhibited by the library will be unknown.
Dependency failing: com.google.firebase:firebase-messaging:18.0.0 -> com.google.firebase:firebase-iid@[18.0.0], but fire
base-iid version was 20.0.2.

If I try to change version in project.properties and build.gradle file, it gives me another error :
Could not determine the dependencies of task ‘:app:compileDebugJavaWithJavac’.
[6:39 PM] Could not resolve all task dependencies for configuration ‘:app:debugCompileClasspath’.

Could not find com.google.firebase:firebase-messaging:20.0.2.
Required by:project :app

Any ideas how to resolve this…?