I am getting the Error as follows, when I try to run the flutter app.
I have set this in build.gradle
classpath 'com.google.gms:google-services:4.3.3'
I have this dependency in app/build.gradle
apply plugin: 'com.google.gms.google-services'
When I remove app/build.gradle google-services plugin, app worked fine. Since I need google-services plugin, I want to know how to solve this problem. Thanks!
This is the flutter doctor -v output.
[✓] Flutter (Channel stable, 2.2.3, on Linux, locale en_US.UTF-8)
• Flutter version 2.2.3 at /opt/flutter
• Framework revision f4abaa0735 (6 days ago), 2021-07-01 12:46:11 -0700
• Engine revision 241c87ad80
• Dart version 2.13.4
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at /home//Android/Sdk
• Platform android-30, build-tools 30.0.2
• Java binary at: /opt/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at google-chrome
[✓] Android Studio (version 4.1)
• Android Studio at /opt/android-studio
• Flutter plugin version 57.0.1
• Dart plugin version 201.9380
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
[✓] IntelliJ IDEA Community Edition (version 2019.3)
• IntelliJ at /home/**/Office Works/Softwares/idea-IC-193.6494.35
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
[✓] IntelliJ IDEA Community Edition (version 2018.2)
• IntelliJ at /opt/idea
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
[✓] VS Code (version 1.50.1)
• VS Code at /usr/share/code
• Flutter extension version 3.17.0
I solved this issue by upgrading the gradle to gradle-6.7. Just change the distributionUrl value on the android/gradle/wrapper/gradle-wrapper.properties
file to this value:
distributionUrl=https://services.gradle.org/distributions/gradle-6.7-all.zip
Or, just run this command on your android/
folder:
./gradlew wrapper --gradle-version 6.7