Cannot use firebase plugin

Hi everyone, I’m using Ionic5 and trying to use firebase. I’ve followed more than 10 tutorials about how to do it, without success(eg: https://www.freecodecamp.org/news/how-to-get-push-notifications-working-with-ionic-4-and-firebase-ad87cc92394e/). I can run project but when I try to generate the apk, stops building.

 What went wrong:
Failed to capture fingerprint of input files for task ':app:preDebugBuild
> In project 'app' a resolved Google Play services library dependency dep
  1]", but isn't being resolved to that version. Behavior exhibited by th

  Dependency failing: com.google.firebase:firebase-messaging:19.0.1 -> co
  base-iid version was 20.0.2.

  The following dependencies are project dependencies that are direct or 
  ifact with the issue.
  -- Project 'app' depends onto com.google.firebase:firebase-messaging@19
  -- Project 'app' depends onto com.google.android.gms:play-services-meas
  -- Project 'app' depends onto com.google.android.gms:play-services-tagm
  -- Project 'app' depends onto com.google.firebase:firebase-perf@18.+
  -- Project 'app' depends onto com.google.firebase:firebase-iid@20.0.2
  -- Project 'app' depends onto com.google.firebase:firebase-core@17.+
  -- Project 'app' depends onto com.google.firebase:firebase-core@17.2.3

I’ve used ionic cordova plugin add cordova-plugin-firebase, ionic cordova plugin add cordova-plugin-firebase-lib. Can’t get it work. Any help?

Thy this Plugin: https://ionicframework.com/docs/native/firebase-x