Ionic 2:Firebase云消息传递和Google服务错误

问题描述:

我试图在一吨地方搜索以获得FCM工作。我正在使用Google身份验证API,并刚刚安装了FCM以使用推送通知。我想使用它们两个。当我建立我得到这些错误。 *出了什么问题: 评估根项目'android'时发生问题。Ionic 2:Firebase云消息传递和Google服务错误

无法应用插件[班 'com.google.gms.googleservices.GoogleServicesPlugin']

 BUILD FAILED 

     Total time: 3.002 secs 
     > For input string: "+" 

这是我project.properties文件

target=android-25 
android.library.reference.1=CordovaLib 
cordova.system.library.1=com.facebook.android:facebook-android-sdk:4.+ 
cordova.system.library.2=com.google.android.gms:play-services-auth:+ 
cordova.system.library.3=com.google.android.gms:play-services-identity:+ 
cordova.system.library.4=com.android.support:support-v13:25.1.0 
cordova.system.library.5=me.leolin:ShortcutBadger:[email protected] 
cordova.system.library.6=com.google.firebase:firebase-messaging:11.0.1 
cordova.gradle.include.1=phonegap-plugin-push/starter-push.gradle 

几件事情我在阅读大量帖子后试过: 1.我删除并添加了android平台,然后做了构建。 2.我尝试将以下库的版本更改为很多值,但它无济于事。

cordova.system.library.2=com.google.android.gms:play-services-auth:+ 
cordova.system.library.3=com.google.android.gms:play-services-identity:+ 

如果试图改变从+版本3.0.0到9.8.0或或任何版本我得到这个错误的火力

* What went wrong: 
     A problem occurred configuring root project 'android'. 
     > Could not resolve all dependencies for configuration ':_debugApkCopy'. 
     > Could not find com.google.firebase:firebase-messaging:11.0.1. 
     Required by: 
     project : 

注:更改的build.gradle文件多申内相同没有帮助,因为在我们构建时会被覆盖。

这是我的package.json。

{ 
    "name": "test", 
    "version": "0.0.1", 
    "author": "Ionic Framework", 
    "homepage": "http://ionicframework.com/", 
    "private": true, 
    "scripts": { 
     "clean": "ionic-app-scripts clean", 
     "build": "ionic-app-scripts build", 
     "lint": "ionic-app-scripts lint", 
     "ionic:build": "ionic-app-scripts build", 
     "ionic:serve": "ionic-app-scripts serve", 
     "start": "node ./bin/www" 
    }, 
    "dependencies": { 
     "@angular/common": "4.1.2", 
     "@angular/compiler": "4.1.2", 
     "@angular/compiler-cli": "4.1.2", 
     "@angular/core": "4.1.2", 
     "@angular/forms": "4.1.2", 
     "@angular/http": "4.1.2", 
     "@angular/platform-browser": "4.1.2", 
     "@angular/platform-browser-dynamic": "4.1.2", 
     "@ionic-native/core": "3.10.2", 
     "@ionic-native/facebook": "^3.10.2", 
     "@ionic-native/google-plus": "^3.12.1", 
     "@ionic-native/native-storage": "^3.10.3", 
     "@ionic-native/splash-screen": "3.10.2", 
     "@ionic-native/status-bar": "3.10.2", 
     "@ionic/storage": "2.0.1", 
     "body-parser": "^1.17.2", 
     "cordova-android": "^6.2.3", 
     "cordova-plugin-console": "^1.0.5", 
     "cordova-plugin-device": "^1.1.4", 
     "cordova-plugin-facebook4": "^1.9.0", 
     "cordova-plugin-googleplus": "^5.1.1", 
     "cordova-plugin-nativestorage": "^2.2.2", 
     "cordova-plugin-splashscreen": "^4.0.3", 
     "cordova-plugin-statusbar": "^2.2.2", 
     "cordova-plugin-whitelist": "^1.3.1", 
     "express": "^4.15.3", 
     "ionic-angular": "3.3.0", 
     "ionic-native": "^2.5.1", 
     "ionic-plugin-keyboard": "^2.2.1", 
     "ionicons": "3.0.0", 
     "mongoose": "^4.11.4", 
     "morgan": "^1.8.2", 
     "phonegap-plugin-push": "^2.0.0", 
     "rxjs": "5.1.1", 
     "serve-favicon": "^2.4.3", 
     "socket.io": "^2.0.3", 
     "socket.io-client": "^2.0.3", 
     "sw-toolbox": "3.6.0", 
     "zone.js": "0.8.11" 
    }, 
    "devDependencies": { 
     "@ionic/app-scripts": "1.3.7", 
     "@ionic/cli-plugin-cordova": "1.6.2", 
     "@ionic/cli-plugin-ionic-angular": "1.4.1", 
     "ionic": "3.7.0", 
     "typescript": "2.3.3" 
    }, 
    "description": "An Ionic project", 
    "cordova": { 
     "plugins": { 
      "cordova-plugin-console": {}, 
      "cordova-plugin-device": {}, 
      "cordova-plugin-splashscreen": {}, 
      "cordova-plugin-statusbar": {}, 
      "cordova-plugin-whitelist": {}, 
      "ionic-plugin-keyboard": {}, 
      "cordova-plugin-facebook4": { 
       "APP_ID": "xxxxxxx2", 
       "APP_NAME": "test" 
      }, 
      "cordova-plugin-googleplus": { 
       "REVERSED_CLIENT_ID": "4xxxxxxxx6-7dsgct91usuntkmomme1n8rq5i7oipq8.apps.googleusercontent.com" 
      }, 
      "phonegap-plugin-push": { 
       "SENDER_ID": "81xxxxx8690" 
      } 
     }, 
     "platforms": [ 
      "android" 
     ] 
    }, 
    "main": "index.js", 
    "keywords": [ 
     "server" 
    ], 
    "license": "ISC" 
} 

有人可以帮助我,建议一个更好的方法来实现推送通知。提前致谢!

+0

我做你的package.json没有本质FCM插件,但如果你已经安装了它,'phonegap-plugin-push'与FCM插件有一些冲突,所以你不能在你的项目中都有。 –

+0

这将是什么工作?我只按照教程安装了phonegap-plugin-push https://ampersandacademy.com/tutorials/ionic-framework-version-2/push-notification-in-ionic-2-native-plugin-version-2-3- with-firebase-hosting-service-provider –

+0

有没有解决方法,你需要卸载推送并安装FCM https://ionicframework.com/docs/native/fcm/然后按照Ionic页面和从插件页面(Ionic页面中的链接) –

尝试安装谷歌库

工具 - > SDK管理器 - >谷歌库

https://i.stack.imgur.com/qe8iu.png