【问题标题】:IONIC 2, How to match versions for Google Service, PushNotifications and FirebaseIONIC 2,如何匹配 Google 服务、PushNotifications 和 Firebase 的版本
【发布时间】:2017-10-19 09:10:11
【问题描述】:

我在使用 ionic2/cordova 时遇到了麻烦(再次)。我不知道如何匹配以下版本: com.google.android.gmscordova-plugin-firebasephonegap plugin push

在编译时我有以下错误:

BUILD FAILED

Total time: 4.038 secs
Error: /home/thor/Projects/App_CDP/platforms/android/gradlew: Command failed with exit code 1 Error output: /home/thor/Projects/App_CDP/platforms/android/src/com/adobe/phonegap/push/FCMService.java:71: error: cannot access zza
    String from = message.getFrom();
                         ^
 class file for com.google.android.gms.common.internal.safeparcel.zza not found

我知道这是因为 Google 服务和 PushNotifications 之间存在版本差异。 我在 gradle.build 中有以下依赖项:

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.+"
     compile "com.google.android.gms:play-services-maps:11.+"
     compile "com.google.android.gms:play-services-location:11.+"
     compile "com.android.support:support-v13:25.1.0"
     compile "me.leolin:ShortcutBadger:1.1.17@aar"
     compile "com.google.firebase:firebase-messaging:11.0.1"
     // SUB-PROJECT DEPENDENCIES END
}

问题是这个文件是自动生成的,所以我无法更改它,而且cordova插件很痛苦。

这是我的插件列表:

$ ionic cordova plugins
> cordova plugin ls
✔ Running command - done!
com.googlemaps.ios 2.4.0 "Google Maps SDK for iOS"
cordova-android-play-services-gradle-release 1.1.1 "cordova-android-play-
services-gradle-release"
cordova-plugin-compat 1.2.0 "Compat"
cordova-plugin-console 1.1.0 "Console"
cordova-plugin-device 1.1.6 "Device"
cordova-plugin-facebook4 1.9.1 "Facebook Connect"
cordova-plugin-file 4.3.3 "File"
cordova-plugin-file-transfer 1.6.3 "File Transfer"
cordova-plugin-googlemaps 1.4.5 "cordova-googlemaps-plugin"
cordova-plugin-inappbrowser 1.7.1 "InAppBrowser"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-statusbar 2.2.3 "StatusBar"
cordova-plugin-whitelist 1.3.2 "Whitelist"
ionic-plugin-keyboard 2.2.1 "Keyboard"
phonegap-plugin-push 2.0.0 "PushPlugin"

这是我的版本:

$ ionic -v
3.13.1
$ cordova -v
7.1.0

【问题讨论】:

  • 我已保存问题,谁能帮忙。

标签: android cordova firebase ionic2 firebase-cloud-messaging


【解决方案1】:

谢谢,

我在这里找到了解决方案:

第 1 步:删除现有的 phonegap-plugin-push

ionic cordova plugin rm phonegap-plugin-push

第 2 步:添加版本相同的插件:1.10.5

ionic cordova plugin add phonegap-plugin-push@1.10.5 --variable SENDER_ID="xxxxxxxxxxx"

第 3 步:删除平台 android 并添加它。

ionic cordova platform rm android

ionic cordova platform add android

第 4 步:最后为 android 创建一个构建

ionic cordova build android

如果此步骤不起作用,请参阅 /project_name/platforms/android/project.properties

cordova.system.library.7=com.google.android.gms:play-services-gcm:11+

玩得开心:)

【讨论】:

    猜你喜欢
    • 2023-03-20
    • 1970-01-01
    • 2014-02-03
    • 1970-01-01
    • 2019-02-14
    • 1970-01-01
    • 2012-01-26
    • 1970-01-01
    • 2013-07-20
    相关资源
    最近更新 更多