cordova-plugin-firebase: Error: Found item String/google_app_id more than one time
Breaking change in the new tag: “cordova-plugin-firebase”: “^0.1.24”,
FAILURE: Build failed with an exception.
- What went wrong: Execution failed for task ‘:mergeReleaseResources’.
/Users/zoltan/Developer/myProject/platforms/android/res/values/strings.xml: Error: Found item String/google_app_id more than one time
The content of strings.xml:
<?xml version='1.0' encoding='utf-8'?>
<resources>
<string name="app_name">My app name</string>
<string name="launcher_name">@string/app_name</string>
<string name="activity_name">@string/launcher_name</string>
<string name="google_app_id">xxxxxxx---xxxxxxx</string>
<string name="google_api_key">xxxxxxx---xxxxxxx</string>
<string name="google_app_id">@string/google_app_id</string>
<string name="google_api_key">@string/google_api_key</string>
</resources>
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 1
- Comments: 23 (3 by maintainers)
Remove this in strings.xml
Work for me
Updating strings.xml or any file created during the build is not a solution it is a workaround of an issue. We need reliable repeatable builds without manually having to update files.
I made a change to the
cordova-plugin-firebase/scripts/after_prepare.js
so that both ios and android get copied if they both exist.I removed and re-added android platform, the error( Found item String/google_app_id more than one time) disappeared.
$ cordova clean android
worked hereTo reproduce the issue:
The problem is, that if the ios platform added, then the after_prepare file runs again. Also it tries:
So the copyKey(PLATFORM.ANDROID, updateStringsXml) runs, it copies the keys, then in the function exception happens, so the callback function won’t be called.
I faced same problem too in 0.1.24. ~And this problem occurs only release build.~ I don’t have another plugin that is also adding google_app_id and google_api_key.