2017-09-13 26 views
1

当我安装cordova-plugin-health时,一切正常,但安装cordova-plugin-fcm后,生成失败。记录如下。自上周以来我一直在努力,现在很难找到我没有看到的Stack Overflow答案。Phonegap + Android + FCM&Health插件

BUILD FAILED 

Total time: 2.923 secs 

Error: /Users/[...]/platforms/android/gradlew: Command failed with exit code 1 Error output: 
Note: Some input files use or override a deprecated API. 
Note: Recompile with -Xlint:deprecation for details. 
Note: Some input files use or override a deprecated API. 
Note: Recompile with -Xlint:deprecation for details. 

FAILURE: Build failed with an exception. 

* What went wrong: 
Execution failed for task ':processDebugGoogleServices'. 
> Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 9.0.0. 

回答

0

有些事情要考虑:

  • 确保你有你的项目的根目录下的 'Google-services.json' 文件(科尔多瓦 - 插件-FCM)
  • 尝试从SDK管理器更新您的Android SDK平台
  • 尝试从您的项目中删除android平台(“phonegap platform remove android”),并添加最新版本的android与“phonegap平台添加android @ latest”

最后一点是为我解决了类似的问题,因为较低版本的phonegap android有最新的FCM/GCM库的问题。

+0

'谷歌services.json' 文件存在。 更新了Android SDK。 平台rm&add @ latest已完成。 仍然是一样的错误。 – kardossandor

+0

你在phonegap中使用的是什么版本的android?即:phonegap插件列表 –

+0

android 6.2.3,cordova-plugin-fcm 2.1.2“FCMPlugin”,cordova-plugin-health 1.0.0“Cordova Health” – kardossandor

0

这是由Gradle配置中的版本冲突引起的。 cordova-plugin-fcm请求com.google.android.gms(播放服务库)的v9.0.0,但是cordova-plugin-healthrequesting the most recent version即。 +latest release是v11.2.0。

this cordova-plugin-fcm issue概述没有一个简单的解决方案,为所有插件冲突的工作原理:cordova-plugin-fcm是有问题的,因为该版本是specified implicitly

一个解决方案,你可以尝试是安装cordova-android-play-services-gradle-release,指定为V9.0.0 PLAY_SERVICES_VERSION

cordova plugin add cordova-android-play-services-gradle-release --variable PLAY_SERVICES_VERSION=9.0.0