flutter / flutter-intellij

Flutter Plugin for IntelliJ
https://flutter.dev/using-ide
BSD 3-Clause "New" or "Revised" License
1.98k stars 318 forks source link

Gradle error with com.google.gms:google-services:4.3.2 #3926

Open iozuniga opened 5 years ago

iozuniga commented 5 years ago

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

stevemessick commented 5 years ago

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.

iamprakash13 commented 5 years ago

yes, possibly there is version incompactibility occurs. @stevemessick @iozuniga

stevemessick commented 4 years ago

For me, this problem went away after I upgraded everything to the latest releases. Please check that Android SDK, Flutter SDK, Android Studio, and its plugins (Dart, Flutter) are up-to-date.

Does that help with your problem?

JasonEdinburgh commented 4 years ago

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.

iozuniga commented 4 years ago

Updated to latest versions of Dart and Flutter. Runed Flutter Upgrade. Runed Flutter packages upgrade on project pubspec.yaml (nothing happened) and the error is still there. Thank you for your support.

Console output

Launching lib\main.dart on Pixel 2 XL in debug mode...
Initializing gradle...
Resolving dependencies...
* Error running Gradle:
ProcessException: Process "C:\Users\Ignacio\AndroidStudioProjects\firebase_test1\android\gradlew.bat" exited abnormally:

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Users\Ignacio\AndroidStudioProjects\firebase_test1\android\app\build.gradle' line: 24

* What went wrong:
A problem occurred evaluating project ':app'.
> ASCII

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

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
  Command: C:\Users\Ignacio\AndroidStudioProjects\firebase_test1\android\gradlew.bat app:properties

Finished with error: Please review your Gradle project setup in the android/ folder.

Version Info

C:\flutter\bin\flutter.bat doctor --verbose [√] Flutter (Channel stable, v1.9.1+hotfix.6, on Microsoft Windows [Versión 10.0.17134.1069], locale es-ES) • Flutter version 1.9.1+hotfix.6 at C:\flutter • Framework revision 68587a0916 (7 weeks ago), 2019-09-13 19:46:58 -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 41.0.2 • Dart plugin version 191.8593 • 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

ginuxone commented 4 years ago

Did anyone find a solution to this? I found that some firebase plugins expect the use of 4.3.0 google services.(There's where the problem comes from). Whenever i try to upgrade to 4.3 it just doesn't build. I'm using vsCode with the latest version of flutter(1.9.1+hotfix.6) and Dart(2.5). `flutter doctor -v [√] Flutter (Channel stable, v1.9.1+hotfix.6, on Microsoft Windows [Versione 10.0.18362.476], locale it-IT) • Flutter version 1.9.1+hotfix.6 at C:\src\flutter • Framework revision 68587a0916 (9 weeks ago), 2019-09-13 19:46:58 -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\ginit\AppData\Local\Android\sdk • Android NDK location not configured (optional; useful for native profiling support) • Platform android-28, build-tools 28.0.3 • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01) • All Android licenses accepted.

[!] Android Studio (version 3.3) • Android Studio at C:\Program Files\Android\Android Studio X Flutter plugin not installed; this adds Flutter specific functionality. X Dart plugin not installed; this adds Dart specific functionality. • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)

[√] VS Code (version 1.40.1) • VS Code at C:\Users\ginit\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.6.0

[√] Connected device (1 available) • POCOPHONE F1 • 950b8c27 • android-arm64 • Android 9 (API 28)`

JasonEdinburgh commented 4 years ago

Yes but have encountered a succession of problems with this and other problems.

My android/build.gradle now has

dependencies {
    classpath 'com.android.tools.build:gradle:3.5.2'
    classpath 'com.google.gms:google-services:4.3.2'
}

This is with Android SDK 28.

I think VSCode and Android studio are unreliable. Updates can fail without warning. Builds get broken and fail fix themselves.

Try this: Reboot your machine. Delete the pubspec.lock file, run flutter clean in a terminal. Then do packages->get and build.

Maybe something was holding a lock on a file or something. I will never know.

I got so frustrated by the unreliable environment that I now have a clean dev machine running in VMWare that I can rollback if something goes wrong.

https://developer.microsoft.com/en-us/windows/downloads/virtual-machines https://www.vmware.com/dk/products/workstation-player/workstation-player-evaluation.html

ginuxone commented 4 years ago

@JasonEdinburgh I'll give it a try and i'll let you know. Right now i fixed my problem by downgrading my plugins to a version that google play services was compatible with.

gabrielmcreynolds commented 4 years ago

I am getting this same problem, but in Android Studio. I feel like this is a major problem as it is making me use google-services 4.2.0

LukeM123 commented 4 years ago

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

nathan1658 commented 4 years ago

Same issue, looking forward to a solution.

gokhangencer commented 4 years ago

same issue, waiting for solution.

DerSIlent commented 4 years ago

same issue

gokhangencer commented 4 years ago

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.

TheWCKD commented 4 years ago

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
  1. Open up {project}/android/gradle/wrapper/gradle-wrapper.properties and update this line
  1. Run your flutter app with Ctrl+F5 and wait for the wrapper to do its job. Voila!
adriansiena11 commented 2 years ago

Could not resolve com.google.gms:google-services:4.3.10.

Could not get resource 'https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.3.10/google-services-4.3.10.pom'. Could not GET 'https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.3.10/google-services-4.3.10.pom'

karmicdice commented 1 year ago

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

Add the following in your settings.gradle

pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}
ridwan-101 commented 7 months ago
   use the latest version 

   classpath 'com.google.gms:google-services:4.4.1'