使用 Cordova google-analytics-plugin 时构建错误

Build error when using Cordova google-analytics-plugin

我正在尝试将 https://github.com/nickdrewe/google-analytics-plugin 添加到我的 cordova 项目中。但是构建失败了。以下是我的尝试:

  1. 安装 google playservices 21 而不是 19。编辑 plugin.xml 以指向 21 但仍然不起作用。

  2. 完全删除 google 播放服务并改用框架 https://github.com/nickdrewe/google-analytics-plugin/commit/cb8e78f17472ae2c8b4db613273764a7260b4e34 但仍然构建错误

  3. 我也试过 android update sdk --no-ui --all --filter "extra-google-m2repository"https://groups.google.com/forum/#!topic/adt-dev/UXW0Hl0UVXk

我得到的错误:

FAILURE: Build failed with an exception.

* What went wrong:
Failed to notify build listener.

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

/vagrant/MyProject/platforms/android/cordova/node_modules/q/q.js:126
                    throw e;
                          ^
Error code 1 for command: /vagrant/MyProject/platforms/android/gradlew with args: cdvBuildDebug,-b,/vagrant/MyProject/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /vagrant/MyProject/platforms/android/cordova/build: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: /vagrant/MyProject/platforms/android/cordova/build: Command failed with exit code 1
    at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:134:23)
    at ChildProcess.emit (events.js:110:17)
    at maybeClose (child_process.js:1015:16)
    at Process.ChildProcess._handle.onexit (child_process.js:1087:5)

我正在使用 Ionic 1.5.5 和 Cordova Android 4.0.2

有什么帮助吗?

我对替代 Google 分析插件持开放态度,但我发现 https://github.com/phonegap-build/GAPlugin 导致 Android 应用程序在启动时崩溃。

我只是试图重现您的错误 - none。我使用您链接的插件和控制台插件构建了一个新项目。构建非常成功。

据我所知,您编辑了 gradle 构建设置以加速 gradle 构建。 -Dorg.gradle.daemon=true...据我阅读文档,这必须是 -org.gradle.daemon=true 还是 D 某物像必须存在的运算符或变量?

您还可以尝试 运行 cmd 作为管理员。

Cordova 从 5.1.1 降级到 4.3.2 解决了许多用户的问题。