0
我試圖在一噸地方搜索以獲得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"
}
有人可以幫助我,建議一個更好的方法來實現推送通知。提前致謝!
我做你的package.json沒有本質FCM插件,但如果你已經安裝了它,'phonegap-plugin-push'與FCM插件有一些衝突,所以你不能在你的項目中都有。 –
這將是什麼工作?我只按照教程安裝了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 –
有沒有解決方法,你需要卸載推送並安裝FCM https://ionicframework.com/docs/native/fcm/然後按照Ionic頁面和從插件頁面(Ionic頁面中的鏈接) –