'Ionic Capacitor FCM , android build failing

I am stuck at the below issue for quite some time and its not getting resolved, had searched across stack overflow, google, but nothing is working for me. There's a workaround suggested on ionic portal, that too is not working. Please help me to resolve the issue.

I have tried to add google-services.json in android/app directory, then the 2nd issue comes, then why I tried to add the same file android/capacitor-cordova-android-plugins directory, then another issue comes stating:

Execution failed for task ':capacitor-cordova-android-plugins:processDebugGoogleServices'. No matching client found for package name 'capacitor.android.plugins'

Below is the original issue, when google-services.json, is not placed anywhere.

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:processDebugGoogleServices'.
> File google-services.json is missing. The Google Services Plugin cannot function without it. 
   Searched Location: 
  /Users/xxxx/development/projects/appName/android/app/google-services.json
  /Users/xxxx/development/projects/appName/android/app/src/nullnull/google-services.json
  /Users/xxxx/development/projects/appName/android/app/src/debug/google-services.json
  /Users/xxxx/development/projects/appName/android/app/src/nullnullDebug/google-services.json
  /Users/xxxx/development/projects/appName/android/app/src/nullnull/debug/google-services.json
  /Users/xxxx/development/projects/appName/android/app/src/debug/nullnull/google-services.json


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':capacitor-cordova-android-plugins:processDebugGoogleServices'.
> File google-services.json is missing. The Google Services Plugin cannot function without it. 
   Searched Location: 
  /Users/xxxx/development/projects/appName/android/capacitor-cordova-android-plugins/google-services.json
  /Users/xxxx/development/projects/appName/android/capacitor-cordova-android-plugins/src/nullnull/google-services.json
  /Users/xxxx/development/projects/appName/android/capacitor-cordova-android-plugins/src/debug/google-services.json
  /Users/xxxx/development/projects/appName/android/capacitor-cordova-android-plugins/src/nullnullDebug/google-services.json
  /Users/xxxx/development/projects/appName/android/capacitor-cordova-android-plugins/src/nullnull/debug/google-services.json
  /Users/xxxx/development/projects/appName/android/capacitor-cordova-android-plugins/src/debug/nullnull/google-services.json


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/7.0/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 3s
118 actionable tasks: 22 executed, 96 up-to-date




Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source