I created an App using Cordova, then followed the instructions to prepare the App to integrate with the Firebase plugin:
- Created the keystore (needed to integrate with Firebase).
- I created the project of the app in Firebase and I informed the hash stored in the keystore.
- I installed the plugin "cordova-plugin-firebase".
- Copy the file google-services.json to the root folder of the project.
After following the plugin and firebase documentation, I came across this error:
:app:processDebugGoogleServices FAILED
FAILURE: Build 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: /myAppCordova2/platforms/android/app/src/nullnull/debug/google-services.json /myAppCordova2/platforms/android/app/src/debug/nullnull/google-services.json /myAppCordova2/platforms/android/app/src/nullnull/google-services.json /myAppCordova2/platforms/android/app/src/debug/google-services.json /myAppCordova2/platforms/android/app/src/nullnullDebug/google-services.json /myAppCordova2/platforms/android/app/google-services.json
Solution proposed here in SO:
Copy google-services.json to directory /platforms/android/app/, but this generated another error:
:app:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
- What went wrong: Execution failed for task ':app:mergeDebugResources'.
[string/google_app_id] /myAppCordova2/platforms/android/app/src/main/res/values/strings.xml [string/google_app_id] /myAppCordova2/platforms/android/app/build/generated/res/google-services/debug/values/values.xml: Error: Duplicate resources [string/google_api_key] /myAppCordova2/platforms/android/app/src/main/res/values/strings.xml [string/google_api_key] /myAppCordova2/platforms/android/app/build/generated/res/google-services/debug/values/values.xml: Error: Duplicate resources
PS: I tried several fixes proposed here in the SO and none solved my problem, could anyone help me?
build.gradlefiles, as I explained in my answer below. - Cleberson Falk