cordova-plugin-firebase: Could not find method google() for arguments [] on repository container

Describe the bug Last version of the plugin causes an error when building the project in ionic.

To Reproduce Create a blank ionic (v3) project. ionic start cordova-firebase-plugin blank Add the plugin

ionic cordova plugin add cordova-plugin-firebase
npm i @ionic-native/firebase

Build the app

ionic cordova build android --prod

Expected behavior The project is build with no errors

Console Logs

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/yc00033/Documents/temp/cordova-firebase-plugin/platforms/android/build.gradle' line: 25

* What went wrong:
A problem occurred evaluating root project 'android'.

> Could not find method google() for arguments [] on repository container.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 3.653 secs
Error: /Users/yc00033/Documents/temp/cordova-firebase-plugin/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* Where:
Build file '/Users/yc00033/Documents/temp/cordova-firebase-plugin/platforms/android/build.gradle' line: 25

* What went wrong:
A problem occurred evaluating root project 'android'.
> Could not find method google() for arguments [] on repository container.

Plugin Version cordova-plugin-firebase 2.0.2 “Google Firebase Plugin”

Additional context I created a project to replicate the issue.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 24 (14 by maintainers)

Commits related to this issue

Most upvoted comments

Hi everyone. I was following this thread because I was with exactly same error. I’m using Ionic 3 and cordova-plugin-firebase. I was using cordova android@6.3.0 and when I upgrade it to 6.4.0 I could build the project without problem. @davidanaya can you try to build with this cordova-android version?

Looks like you are using Gradle 3.3 for building your project. Check out these directions on how to upgrade your gradle version, https://blog.nishtahir.com/2018/04/15/how-to-properly-update-the-gradle-wrapper/ I am running 4.4. Based on the few stackoverflow posts I read, that should resolve your issue. You might consider upgrading your gradle version more often as 3.3 is well over a year and a half old…

Works like a charm, @soumak77 thanks!