Reputation: 1
I try to Add FCM to my application using Capacitor
https://ionicframework.com/docs/native/fcm
I add the google servies.json to android\app
i change the code
from classpath 'com.google.gms:google-services:4.3.3'
To classpath 'com.google.gms:google-services:4.3.4'
as firebase documentation
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.1'
classpath 'com.google.gms:google-services:4.3.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
apply from: "variables.gradle"
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
try to run the application in emulater but i got error in android studio
File google-services.json is missing. The Google Services Plugin cannot function without it.
Searched Location:
C:\Users\User\Documents\IONICProject\sahha-admin\android\capacitor-cordova-android-plugins\src\nullnull\google-services.json
C:\Users\User\Documents\IONICProject\sahha-admin\android\capacitor-cordova-android-plugins\src\debug\google-services.json
C:\Users\User\Documents\IONICProject\sahha-admin\android\capacitor-cordova-android-plugins\src\nullnullDebug\google-services.json
C:\Users\User\Documents\IONICProject\sahha-admin\android\capacitor-cordova-android-plugins\src\nullnull\debug\google-services.json
C:\Users\User\Documents\IONICProject\sahha-admin\android\capacitor-cordova-android-plugins\src\debug\nullnull\google-services.json
C:\Users\User\Documents\IONICProject\sahha-admin\android\capacitor-cordova-android-plugins\google-services.json
Environment :
win 10 Mobile android version: 9 Cordova CLI version : 9.0.0 ([email protected]) IONIC version : 6.10.1 Android Studio version :4.0.1
Package.json
{
"name": "sahha-admin",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "https://ionicframework.com/",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/common": "~9.1.6",
"@angular/core": "~9.1.6",
"@angular/fire": "^6.0.2",
"@angular/forms": "~9.1.6",
"@angular/platform-browser": "~9.1.6",
"@angular/platform-browser-dynamic": "~9.1.6",
"@angular/router": "~9.1.6",
"@capacitor-community/fcm": "^1.0.8",
"@capacitor/android": "^2.4.0",
"@capacitor/core": "2.4.0",
"@ionic-native/camera": "^5.28.0",
"@ionic-native/core": "^5.0.7",
"@ionic-native/fcm": "^5.28.0",
"@ionic-native/file": "^5.28.0",
"@ionic-native/file-path": "^5.28.0",
"@ionic-native/globalization": "^5.28.0",
"@ionic-native/image-picker": "^5.27.0",
"@ionic-native/splash-screen": "^5.0.0",
"@ionic-native/status-bar": "^5.0.0",
"@ionic/angular": "^5.0.0",
"@ngx-translate/core": "^12.1.2",
"@ngx-translate/http-loader": "^5.0.0",
"cordova-plugin-camera": "^4.1.0",
"cordova-plugin-fcm-with-dependecy-updated": "^7.3.1",
"cordova-plugin-file": "^6.0.2",
"cordova-plugin-filepath": "^1.5.8",
"cordova-plugin-globalization": "^1.11.0",
"cordova-plugin-telerik-imagepicker": "^2.3.3",
"firebase": "^7.22.1",
"jetifier": "^1.6.6",
"rxjs": "~6.5.1",
"sweetalert2": "^9.17.1",
"tslib": "^1.10.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.901.5",
"@angular/cli": "~9.1.5",
"@angular/compiler": "~9.1.6",
"@angular/compiler-cli": "~9.1.6",
"@angular/language-service": "~9.1.6",
"@capacitor/cli": "2.4.0",
"@ionic/angular-toolkit": "^2.3.3",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.11.1",
"codelyzer": "^5.1.2",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~5.0.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~2.1.0",
"karma-jasmine": "~3.0.1",
"karma-jasmine-html-reporter": "^1.4.2",
"protractor": "^7.0.0",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~3.8.3"
},
"description": "An Ionic
projects"
}
Upvotes: 0
Views: 1220
Reputation: 72
as per show your question, I also have the same problem a few months ago and I fixed with following steps.
1). first, remove fcm plugin from the project
2). download the google-services.json file from firebase console
3). put the google-services.json file on the root folder of the project
4). also put in platform/android/ folder
then install fcm plugin and clean build and rebuild again
this process is working for me to try and if not working then also refer the following link it's helped me and maybe you.
File google-services.json is missing. The Google Services Plugin cannot function without it ionic 3
https://github.com/fechanique/cordova-plugin-fcm/issues/219
Upvotes: 1