flutter-intellij: Gradle error with com.google.gms:google-services:4.3.2

Hi,

I’m trying to test Firebase on Flutter and I did follow the instructions of the web site and I had the following error:

* Error running Gradle:
ProcessException: Process "....\firebase_test1\android\gradlew.bat" exited abnormally:
FAILURE: Build failed with an exception.
* Where:
Build file '...\firebase_test1\android\app\build.gradle' line: 24

Line 24 has this code: apply plugin: ‘com.android.application’

BTW, If I run Gradle directly from the command line threre is no error at all:

Welcome to Gradle 4.10.2.
To run a build, run gradlew <task> ...
To see a list of available tasks, run gradlew tasks
To see a list of command-line options, run gradlew --help
To see more detail about a task, run gradlew help --task <task>
For troubleshooting, visit https://help.gradle.org
BUILD SUCCESSFUL in 1s
1 actionable task: 1 executed

If I change classpath ‘com.google.gms:google-services:4.3.2’ to classpath ‘com.google.gms:google-services:4.2.0’, the problem dissapears.

Version info

C:\flutter\bin\flutter.bat doctor --verbose [√] Flutter (Channel stable, v1.9.1+hotfix.4, on Microsoft Windows [Versión 10.0.17134.1006], locale es-ES) • Flutter version 1.9.1+hotfix.4 at C:\flutter • Framework revision cc949a8e8b (4 days ago), 2019-09-27 15:04:59 -0700 • Engine revision b863200c37 • Dart version 2.5.0

[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3) • Android SDK at C:/Users/Ignacio/AppData/Local/Android/Sdk • Android NDK location not configured (optional; useful for native profiling support) • Platform android-29, build-tools 28.0.3 • ANDROID_HOME = C:/Users/Ignacio/AppData/Local/Android/Sdk • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03) • All Android licenses accepted.

[√] Android Studio (version 3.5) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin version 40.0.2 • Dart plugin version 191.8423 • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)

[√] VS Code, 32-bit edition (version 1.35.1) • VS Code at C:\Program Files (x86)\Microsoft VS Code • Flutter extension version 3.1.0

[√] Connected device (1 available) • Pixel 2 XL • 711KPQJ0575612 • android-arm64 • Android 10 (API 29)

• No issues found! Process finished with exit code 0

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 3
  • Comments: 17 (2 by maintainers)

Most upvoted comments

For me the following method worked and fixed the issue (on VSCode)

  1. Open up {project}/android/build.gradle and modify the following dependencies as seen below
  • classpath ‘com.android.tools.build:gradle:3.5.3’
  • classpath ‘com.google.gms:google-services:4.3.3’
  1. Open up {project}/android/gradle/wrapper/gradle-wrapper.properties and update this line
  • distributionUrl=https://services.gradle.org/distributions/gradle-5.4.1-all.zip
  1. Run your flutter app with Ctrl+F5 and wait for the wrapper to do its job. Voila!

It is resolved,

I have upgraded from flutter_windows_v1.9.1+hotfix.6-stable to v1.12.13+hotfix.5 via flutter https://flutter.dev/docs/development/tools/sdk/upgrading

then, remove line: apply plugin: ‘com.google.gms.google-services’

open android studio, sync gradle and connect to firebase (tools\firebase\authentication\connect to firebase).

then you can return to vscode and run

add line: apply plugin: ‘com.google.gms.google-services’

flutter run succeed and google sign in works.

Has anyone found a solution to this? I am getting the same error as OP when I try to upgrade google-services to 4.3.2 to run firebase

Ran into this today. Eventually reverted to 3.2.0 as per this video (https://youtu.be/DqJ_KjFzL9I?t=299) I then found this github page. I encountered this issue on vscode, not intellij.

Thanks for the report! The version mis-match is interesting. It suggests Android Studio has different dependencies than Flutter expects. @xster have you seen anything similar?

BTW I’m seeing a similar problem with Flutter add-to-app modules. Building from the command line works, but running it from Android Studio shows a similar problem with not being able to load a com.android.* plugin.

Some plugins just won’t load because of unmet repo.

Add the following in your settings.gradle

pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}