I have an ionic 3 project and I wanted to add firebase to the project.
I installed the firebase cordova plugin and placed my google-services.json in resources/
Try this steps.
first remove your android platform to your project using ionic cordova platform remove android
copy google-services.json file to the root directory (where package.json/config.xml file).
then try to add android platoform using ionic cordova platform add android.then check your android folder google-services.json file copied automatically,if not then copy it to the android folder.
Then check your build.gradle fileto include the google-services plugin and the Google's Maven repository:
buildscript{
//add dependencies as per your google-service version
dependencies {
classpath 'com.google.gms:google-services:4.2.0' // google-services plugin
}
allprojects {
repositories {
google() // Google's Maven repository
}
}
Then, in your module Gradle file (app/build.gradle), add the apply plugin line at the bottom of the file to enable the Gradle plugin
dependencies {
implementation 'com.google.firebase:firebase-core:16.0.7'
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
Note:If you are using codova-android >= 7, you now must add
<platform name="android">
<resource-file src="google-services.json" target="app/google-services.json" />
</platform>