【发布时间】:2018-06-07 09:00:05
【问题描述】:
在这里,我正在尝试为 android 设备生成构建,但我收到了一个错误,定义如下,我的项目在具有 fire-store(测试版)的 ionic 中。 谁能帮我解决它:
BUILD FAILED in 2s
[string/google_api_key] ...............\platforms\android\app\src\main\res\values\strings.xml [string/google_api_key] ...............\platforms\android\app\build\generated\res\google-services\debug\values\values.xml: Error: Duplicate resources
:app:mergeDebugResources FAILED
22 actionable tasks: 2 executed, 20 up-to-date
(node:6472) UnhandledPromiseRejectionWarning: Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> [string/google_app_id] ................\platforms\android\app\src\main\res\values\strings.xml [string/google_app_id] ................\platforms\android\app\build\generated\res\google-services\debug\values\values.xml: Error: Duplicate resources
[string/google_api_key] ................\platforms\android\app\src\main\res\values\strings.xml [string/google_api_key] ................\platforms\android\app\build\generated\res\google-services\debug\values\values.xml: Error: Duplicate resources
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
at ChildProcess.whenDone (..............\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
at ChildProcess.emit (events.js:160:13)
at maybeClose (internal/child_process.js:943:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
(node:6472) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:6472) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
【问题讨论】:
-
发现同样的错误。你有解决办法吗?
-
@AnkitMaheshwari 是的,我得到了解决方案。这里需要从 android.json 文件中删除 google_app_id & google_api_key。
-
谢谢@VaishaliVC 我试过了,但我通常使用 Ionic Pro Package build 生成生产版本。在那里我们无法控制 android.json 文件。
-
@AnkitMaheshwari 首先尝试解决简单构建中的错误。一旦它被删除,然后生成生产版本。
标签: android cordova firebase ionic-framework ionic3