Cordova   发布时间:2022-05-03  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了cordova – 由于与谷歌gms服务的版本冲突,FCMPlugin构建失败大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

我正在 Windows for Android上使用离子2.当我添加cordova-plugin-fcm插件时,我无法再构建项目了.这是我得到的错误: BUILD FAILED @R_529_10586@l time: 4.697 secs
我正在 Windows for Android上使用离子2.当我添加cordova-plugin-fcm插件时,我无法再构建项目了.这是我得到的错误

BUILD Failed                                                                                     

@R_529_10586@l 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的片段:

<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"/>

我已经阅读了thisthis related帖子,建议将此行添加到build.gradle(由离子自动创建):

我已经尝试将它添加到build-extras.gradle而没有运气.

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

// 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
}

我错过了什么,我该如何解决这个问题?

解决方法

解决

plugings:

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

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

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

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

更换:

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

有:

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

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

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

更改“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

就这样 :).

大佬总结

以上是大佬教程为你收集整理的cordova – 由于与谷歌gms服务的版本冲突,FCMPlugin构建失败全部内容,希望文章能够帮你解决cordova – 由于与谷歌gms服务的版本冲突,FCMPlugin构建失败所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。