使用Cordova google-analytics-plugin时出错

时间:2022-03-07 14:04:06

I am trying to add https://github.com/nickdrewe/google-analytics-plugin to my cordova project. But the build failed. Here are what I tried:

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

  1. Install google playservices 21 instead of 19. Edit plugin.xml to point to 21 but still don't work.

    安装google playservices 21而不是19.编辑plugin.xml指向21但仍然无法正常工作。

  2. Remove google playservices completely and use framework instead https://github.com/nickdrewe/google-analytics-plugin/commit/cb8e78f17472ae2c8b4db613273764a7260b4e34 but still build error

    完全删除google playservices并使用框架代替https://github.com/nickdrewe/google-analytics-plugin/commit/cb8e78f17472ae2c8b4db613273764a7260b4e34但仍然构建错误

  3. I also tried android update sdk --no-ui --all --filter "extra-google-m2repository" from https://groups.google.com/forum/#!topic/adt-dev/UXW0Hl0UVXk

    我还试过https://groups.google.com/forum/#!topic/adt-dev/UXW0Hl0UVXk的android update sdk --no-ui --all --filter“extra-google-m2repository”

The error I got:

我得到的错误:

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)

I am using Ionic 1.5.5 and Cordova Android 4.0.2

我正在使用Ionic 1.5.5和Cordova Android 4.0.2

Any help?

I am open to alternative Google Analytics plugin but I found https://github.com/phonegap-build/GAPlugin causing Android app crashing upon start.

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

1 个解决方案

#1


0  

I just tried to reproduce your error - and there is none. I build a new project with the plugin you linked and also the console plugin. The build was totaly fine and successfull.

我只是试图重现你的错误 - 而且没有。我使用您链接的插件和控制台插件构建了一个新项目。构建完全正常并且成功。

As far as i see you edited your gradle build settings for speeding up the gradle build. -Dorg.gradle.daemon=true... as far as i read through the documents this must be -org.gradle.daemon=true or is the D sth like an operator or a variable which has to be there?

据我所知,您编辑了gradle构建设置以加快gradle构建。 -Dorg.gradle.daemon = true ...据我阅读文件,这必须是-org.gradle.daemon = true或者是像操作员或必须存在的变量一样的D?

What you can also try is to run the cmd as an administrator.

您还可以尝试以管理员身份运行cmd。

Cordova downgrade from 5.1.1 to 4.3.2 fixed the problem for many users.

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

#1


0  

I just tried to reproduce your error - and there is none. I build a new project with the plugin you linked and also the console plugin. The build was totaly fine and successfull.

我只是试图重现你的错误 - 而且没有。我使用您链接的插件和控制台插件构建了一个新项目。构建完全正常并且成功。

As far as i see you edited your gradle build settings for speeding up the gradle build. -Dorg.gradle.daemon=true... as far as i read through the documents this must be -org.gradle.daemon=true or is the D sth like an operator or a variable which has to be there?

据我所知,您编辑了gradle构建设置以加快gradle构建。 -Dorg.gradle.daemon = true ...据我阅读文件,这必须是-org.gradle.daemon = true或者是像操作员或必须存在的变量一样的D?

What you can also try is to run the cmd as an administrator.

您还可以尝试以管理员身份运行cmd。

Cordova downgrade from 5.1.1 to 4.3.2 fixed the problem for many users.

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