由于与谷歌gms服务的版本冲突,FCMPlugin构建失败 [英] FCMPlugin build fail due to version conflict with google gms services

查看:138
本文介绍了由于与谷歌gms服务的版本冲突,FCMPlugin构建失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows for Android上使用离子2。当我添加cordova-plugin-fcm插件时,我无法再构建项目了。这是我得到的错误:

I'm using this with ionic 2 on Windows for Android. When I add cordova-plugin-fcm plugin, I cannot build the project anymore. Here is the error that I'm getting:

BUILD FAILED                                                                                     

Total time: 4.697 secs                                                                           

Error: cmd: Command failed with exit code 1 Error output:                                        
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 (i
nformation 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.2.0.        

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

以下是我的config.xml的片段:

Below is a snippet of my config.xml:

 <plugin name="cordova-plugin-console" spec="~1.0.3"/>
  <plugin name="cordova-plugin-facebook4" spec="~1.7.3">
    <variable name="APP_ID" value="XXX"/>
    <variable name="APP_NAME" value="XXX"/>
  </plugin>
  <plugin name="cordova-plugin-whitelist" spec="~1.2.2"/>
  <plugin name="cordova-plugin-statusbar" spec="~2.1.3"/>
  <plugin name="cordova-plugin-splashscreen" spec="~3.2.2"/>
  <plugin name="ionic-plugin-keyboard" spec="~2.2.1"/>
  <plugin name="cordova-plugin-camera"/>
  <plugin name="cordova-plugin-geolocation" spec="https://github.com/apache/cordova-plugin-geolocation"/>
  <plugin name="cordova-plugin-googlemaps" spec="https://github.com/phonegap-googlemaps-plugin/cordova-plugin-googlemaps">
    <variable name="API_KEY_FOR_ANDROID" value="XXXX"/>
    <variable name="API_KEY_FOR_IOS" value="XXXX"/>
  </plugin>
  <plugin name="cordova-plugin-file-transfer" spec="~1.5.1"/>
  <plugin name="cordova-plugin-file" spec="~4.2.0"/>
  <plugin name="cordova-plugin-device" spec="~1.1.2"/>

我已阅读 this 这个相关的帖子建议将此行添加到build.gradle(由离子自动创建):

I have read this and this related posts which suggest adding this line to build.gradle (which is created automatically by ionic):


apply plugin:'com.google.gms.google-services'

我尝试将它添加到build-extras.gradle但没有运气。

I have tried adding it to build-extras.gradle with no luck.

在我的build.graddle中,我看到这一行:

In my build.graddle, I see this line:

// PLUGIN GRADLE EXTENSIONS START
apply from: "cordova-plugin-fcm/upfront-FCMPlugin.gradle"
// PLUGIN GRADLE EXTENSIONS END

以及这些行:

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    // SUB-PROJECT DEPENDENCIES START
    debugCompile project(path: "CordovaLib", configuration: "debug")
    releaseCompile project(path: "CordovaLib", configuration: "release")
    compile "com.facebook.android:facebook-android-sdk:4.14.+"
    compile "com.google.android.gms:play-services-maps:+"
    compile "com.google.android.gms:play-services-location:+"
    // SUB-PROJECT DEPENDENCIES END
}

我错过了什么以及如何解决这个问题?

What am I missing and how can I fix this issue?

推荐答案

我解决了这个问题。

插件:

https://github.com/mauron85/cordova-plugin-background-geolocation

https://github.com/fechanique/cordova-plugin-fcm

1 )。删除平台:cordova平台rm android。

1). remove platform: cordova platform rm android.

2)。修改:plugins / cordova-plugin -fcm / src / android / FCMPlugin.gradle

2). modify: plugins/cordova-plugin-fcm/src/android/FCMPlugin.gradle

替换:

apply plugin: com.google.gms.googleservices.GoogleServicesPlugin

with :

ext.postBuildExtras = {
    apply plugin: com.google.gms.googleservices.GoogleServicesPlugin
}

3)添加平台:cordova平台添加android。

3) add platform: cordova platform add android.

4)修改:platforms / android / project.properties

4) modify: platforms/android/project.properties

更改11.4.2的+:

change the "+" for "11.4.2":

com.google.firebase:firebase-core:+
com.google.firebase:firebase-messaging:+
com.google.android.gms:play-services-location:+

应如下所示:

com.google.firebase:firebase-core:11.4.2
com.google.firebase:firebase-messaging:11.4.2
com.google.android.gms:play-services-location:11.4.2

就这样 :)。

这篇关于由于与谷歌gms服务的版本冲突,FCMPlugin构建失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆