2017-10-19 81 views
1

我遇到了ionic2/cordova(再次)的問題。我不知道如何匹配以下版本: com.google.android.gmscordova-plugin-firebasephonegap plugin pushIONIC 2,如何匹配Google服務,PushNotifications和Firebase的版本

在編譯的恩,我有以下錯誤:

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 

我的理解,這是因爲谷歌的服務和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:[email protected]" 
    compile "com.google.firebase:firebase-messaging:11.0.1" 
    // SUB-PROJECT DEPENDENCIES END 
} 

的問題是,這個文件是自動生成的,所以我不能改變它,科爾多瓦插件是一種痛苦。

這裏是我的插件列表:

$ 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 
+0

我保存問題,任何人都可以幫忙。 – Kamlesh

回答

0

感謝,

我解決我在這裏:

第1步:刪除現有的phonegap-plugin-push

ionic cordova plugin rm phonegap-plugin-push 

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

ionic cordova plugin add [email protected] --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+ 

工作步驟玩得開心:)

相關問題