我正在按照https://github.com/fechanique/cordova-plugin-fcm的说明在我的Ionic 1项目中使用FCM插件,但遇到了麻烦。

当我运行“ ionic run android”时,我得到:

> Could not open dsl remapped class cache for 90dph5obcol5uraf1d1h262ym (C:\Users\arivan\.gradle\caches\2.13\scripts-remapped\condoclass_FCMPlugin_auvalosjdpfzmwa03yh9kenur\90dph5obcol5uraf1d1h262ym\dsl-1812427186).
   > Could not open dsl generic class cache for script 'C:\Projetos\condo-class\platforms\android\cordova-plugin-fcm\condoclass-FCMPlugin.gradle' (C:\Users\arivan\.gradle\caches\2.13\scripts\90dph5obcol5uraf1d1h262ym\dsl\dsl-1812427186).
      > com/google/gms/googleservices/GoogleServicesPlugin : Unsupported major.minor version 51.0


如果我评论行

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


在platform \ android \ cordova-plugin-fcm \ MyProject-FCMPlugin.gradle文件中,构建过程成功运行,但是我的应用在启动时崩溃。

以下是我的项目插件列表:

com.telerik.plugins.nativepagetransitions 0.6.5 "Native Page Transitions"
com.telerik.plugins.wkwebview 0.6.9 "WKWebView Polyfill"
cordova-plugin-compat 1.0.0 "Compat"
cordova-plugin-console 1.0.3 "Console"
cordova-plugin-device 1.1.2 "Device"
cordova-plugin-fcm 1.1.4 "FCMPlugin"
cordova-plugin-file 4.2.0 "File"
cordova-plugin-file-transfer 1.5.1 "File Transfer"
cordova-plugin-inappbrowser 1.4.0 "InAppBrowser"
cordova-plugin-splashscreen 3.2.2 "Splashscreen"
cordova-plugin-statusbar 2.1.3 "StatusBar"
cordova-plugin-whitelist 1.2.2 "Whitelist"
ionic-plugin-keyboard 2.2.1 "Keyboard"


以下是我的Android SDK管理器的“其他”部分:

cordova - Cordova FCM插件-Google Services插件不受支持的major.minor版本51.0-LMLPHP

怎么了?

最佳答案

查看此issue link

您可能需要调整链接中提到的project.properties和FCMPlugin.gradle。

在project.properties中添加,


cordova.system.library.2 = com.google.android.gms:play-services-gcm:9.0.2
cordova.system.library.3 = com.google.android.gms:play-services-analytics:9.0.2
cordova.system.library.4 = com.google.android.gms:play-services-location:9.0.2


在FCMPlugin.gradle中,


依赖项{编译'com.google.firebase:firebase-core:9.0.2'
编译'com.google.firebase:firebase-messaging:9.0.2'}


project.properties文件位于platforms/android/目录下。

希望能帮助到你

07-28 03:11
查看更多