/ firebase

FlutterFire Compile Errors

I was recently setting up an app to use firebase_auth and got the following gradle compile errors:

google-services plugin could not detect any version for com.google.android.gms or com.google.firebase, default version: 9.0.0 will be used.
please apply google-services plugin at the bottom of the build file.

FAILURE: Build failed with an exception.

* Where:
Build file '~/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.4.0/android/build.gradle' line: 6

* What went wrong:
A problem occurred evaluating project ':firebase_auth'.
> 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.


I spent longer than I should have verifying all my build.gradle files, making sure I was properly applying the google-services plugin at the bottom of the build file, correct version of google-services, etc.

The fix? Updating gradle to the latest version.
(Android Studio was telling me that updated version were available, so I figured "Why not?", then it worked)

Follow the instructions on the flutter wiki page : Updating-Flutter-projects-to-Gradle-4.1-and-Android-Studio-Gradle-plugin-3.0.1

The following instructions are a condensed version of the wiki page that just update the bare minimum to get it to work. It is recommended to follow the steps on the wiki page, but these touch fewer places.

Update the gradle dependency to 3.0.1 for the build (my previous version was 2.3.3)


classpath 'com.android.tools.build:gradle:3.0.1'

Update the gradle wrapper to 4.1



There's a new gradle warning that shows up (aside from the deprecated warnings you get from some of the libraries):

Warning:The specified Android SDK Build Tools version (25.0.3) is ignored, as it is below the minimum supported version (26.0.2) for Android Gradle Plugin 3.0.1.
Android SDK Build Tools 26.0.2 will be used.
To suppress this warning, remove "buildToolsVersion '25.0.3'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.

This is pretty easy to fix.


    buildToolsVersion '26.0.2'

(At the time of this writing, the recommended version is 26.0.3 or later, but this is the minimum required version).

After saving these updates, run the build again. It will take some time to download the new version of gradle, then the application will build just like magic.

Brian Armstrong

A web application developer with 15+ years programming experience. Flutter evangelist, React.js enthusiast.

Read More