EddyVerbruggen / nativescript-plugin-firebase

:fire: NativeScript plugin for Firebase
https://firebase.google.com
MIT License
1.01k stars 448 forks source link

NS7.0: Plugin with id 'com.google.gms.google-services' not found. #1656

Closed brysem closed 1 year ago

brysem commented 3 years ago

Hello,

We were using this plugin with NativeScript 6.15. After ugrading to NativeScript 7.0 the firebase plugin is providing the following error:

Script './omitted/node_modules/@nativescript/firebase/platforms/android/include.gradle' line: 96
A problem occurred evaluating script.
Plugin with id 'com.google.gms.google-services' not found.

As suggested in all of the previous issues with this same error I have run the setup again, (cd node_modules/@nativescript/firebase && npm run setup), generating all of the required hooks anew. I have attempted to reinstall all node_modules.

➜ tns info
✔ Getting NativeScript components versions information...
✔ Component nativescript has 7.0.3 version and is up to date.
✔ Component @nativescript/core has 7.0.0 version and is up to date.
✔ Component @nativescript/ios has 7.0.0 version and is up to date.
✔ Component @nativescript/android has 7.0.0 version and is up to date.
"dependencies": {
  "@nativescript/firebase": "rc", // 11.0.0-rc.5
}

Any ideas what may be wrong?

MrSnoozles commented 3 years ago

Not really having an idea here, but did you change import * as firebase from @nativescript/firebase to import { firebase } from @nativescript/firebase?

That is listed as breaking change in https://nativescript.org/blog/nativescript-7-compatible-plugins/

hrueger commented 3 years ago

I was able to solve this issue by adding classpath "com.google.gms:google-services:4.3.0" to platforms/android/build.gradle in the dependencies block. However, this has to be done every time the platforms folder is added...

ngocnt1 commented 3 years ago

@brysem please ensure your NS cli is 7.0.6 + @nativescript/firebase 11.0.0-rc5 it would help to fix this.

hrueger commented 3 years ago

@ngocnt1 I have nativescript@7.0.6 and the issue occurs anyway...

ngocnt1 commented 3 years ago

did you try ns platform clean android or ns platform remove/add android or ns clean because i met the same issue but it worked on 7.0.6

soscler commented 3 years ago

I was able to solve this issue by adding classpath "com.google.gms:google-services:4.3.0" to platforms/android/build.gradle in the dependencies block. However, this has to be done every time the platforms folder is added...

The problem is that by deleting the platforms files, you also delete information that was automatically added when you installed the firebase plugin.

Another way to solve this is to re-install the firebase plugin tns plugin remove nativescript-plugin-firebase then tns plugin add nativescript-plugin-firebase. By doing so, you leave to the cli the task to add the missing dependencies in the file platforms/android/build.gradle.

zeejay09 commented 2 years ago

I am in NS 8 and I encountered this issue, what I did was what @soscler instructed, remove and add the plugin, in addition, I deleted the platforms and hooks folder, then run tns debug android --bundle or whatever command you like, then the error is gone.

armourjami commented 1 year ago

To work around this, you can try the following:

Create a new file (or add to your exisiting) called file build.gradle and add the following (or merge into the existing).

repositories {
    google()
    mavenCentral()
}

dependencies {
    classpath "com.google.gms:google-services:4.3.12"
}