android - Android 构建失败,字符串/google_app_id 重复资源错误
问题描述
我正在研究 ionic 4。当我在 cmd 中运行此命令时:
ionic Cordova build android
它给了我一个重复的资源错误。我在我的项目中使用 firebase 和 google services.json 插件。
我试图从 Andriod.xml 文件中删除 google_app_id 和 google_api_key 但没有改变。一次又一次地显示相同的错误。这是 android.xml 文件的视图。
Android.xml 文件
"res/values/strings.xml": {
"parents": {
"/resources": [
// removed google_app_id & google_api_key
]
}
}
}
字符串.xml 文件:
<resources>
<string name="app_name">UrbanX Driver</string>
<string name="launcher_name">@string/app_name</string>
<string name="activity_name">@string/launcher_name</string>
<string name="google_app_id">@string/google_app_id</string>
<string name="google_api_key">@string/google_api_key</string>
</resources>
Config.xml 文件:
<resource-file src="google-services.json" target="app/google-services.json" />
解决方案
安装这个插件cordova-android-play-services-gradle-release:
ionic cordova plugin add cordova-android-play-services-gradle-release
检查此链接的原因:
https://github.com/arnesson/cordova-plugin-firebase#google-play-services
推荐阅读
- typescript - 将 firebase 链式方法重写为 promise.all
- php - 在 Laravel 中使用 ajax 上传图片
- r - 如何在 facet wrap 中组织绘图顺序
- angular - 根据复选框值启用/禁用输入表单字段
- ruby-on-rails - 如何在rails中使用reportskit创建多列表格报告?
- c++ - 如何从 C++ 应用程序以管理员权限运行动态生成的 cmd 脚本
- docker - 如果crictl可以从localhost拉取镜像,为什么k3s无法在localhost上部署呢?
- google-apps-script - Gmail 应用程序:查找具有日历条目的线程
- php - WordPress 使用 AJAX 提交术语产品循环的表单
- javascript - 如何在 Kendo 多选变量中获取选定的文本?