Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: A problem occurred configuring project ':app'

After starting a new Flutter project, I wanted to work with Firebase in my project, I added following to the project:

  • firebase_core and firebase_auth to the pubspec.yaml
  • google-services.json to the corresponding path
  • classpath 'com.google.gms:google-services:4.3.6' to android/build.gradle
  • implementation platform('com.google.firebase:firebase-bom:28.0.0') to the "dependencies" in the app/build.gradle

Until now everything works well, but after adding this line to the app/build.gradle :

  • apply plugin: 'com.google.gms.google-services'

After adding this line and even without editing the application code, I got the following error message:

Launching lib\main.dart on sdk gphone x86 arm in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\1337\StudioProjects\teest\android\build.gradle' line: 27
* What went wrong:
A problem occurred evaluating root project 'android'.
> A problem occurred configuring project ':app'.
   > org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException: Could not find method setVariantDir() for arguments [debug] on task ':app:processDebugGoogleServices' of type com.google.gms.googleservices.GoogleServicesTask.
* 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 4s
Exception: Gradle task assembleDebug failed with exit code 1

This is my android/build.gradle

buildscript {...}
    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.6'
    }
}
allprojects {...}
rootProject.buildDir = '../build'
subprojects {... }
subprojects {
    project.evaluationDependsOn(':app')
}
task clean(type: Delete) {...}

Ps: by running flutter doctor -v is everything fine.

like image 511
arrmani88 Avatar asked Aug 03 '26 10:08

arrmani88


1 Answers

Try changing:

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

to

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

in android/build.gradle.

If they still fail for you then make sure that you are using the latest update of android SDK, android studio, flutter SDK, Gradle version, and project dependencies.

Also, let me know if that doesn't work for you.

like image 119
Deepanshu Avatar answered Aug 05 '26 08:08

Deepanshu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!