Google 使用 Ionic 进行分析

Google Analytics with Ionic

我正在尝试使用 this 将 Google Analytics 添加到 Ionic/phonegap/Covdova 应用程序中。但是,我收到这些错误:

A problem occurred configuring root project 'android'. Could not resolve all dependencies for configuration ':_debugCompile'. Could not find any version that matches com.google.android.gms:play-service s-analytics:+. Searched in the following locations: https://repo1.maven.org/maven2/com/google/android/gms/play-services-ana lytics/maven-metadata.xml https://repo1.maven.org/maven2/com/google/android/gms/play-services-ana lytics/ Required by: :android:unspecified

我安装了 Android SDK 和 Google Play 服务。我什至尝试使用文档中提到的旧版本:cordova plugin add cordova-plugin-google-analytics@0.7.1 但这会产生相同的错误。

我遇到了同样的问题,并在 this comment 中找到了答案。

运行 android 然后 installing/updating

  • Android 支持存储库
  • Android 支持库
  • Google 播放服务
  • Google 存储库

为我解决了问题。

听起来好几个人也不得不更改插件版本

cordova plugin add cordova-plugin-google-analytics@0.7.1

但我不必这样做。

尝试删除平台并重新添加,

ionic platform rm android

ionic platform add android

这个技巧对我有用。