FAILURE: Build failed with an exception.
-
Where:
Build file ‘C:UsersASUSDocumentsfypandroidbuild.gradle’ line: 7 -
What went wrong:
A problem occurred evaluating root project ‘android’.
Could not find method classpath() for arguments [com.google.gms:google-services:4.4.1] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
2
Answers
You can add your compatible version of this codes to the top of android/build.gradle file. Mine is working like that.
also settings.gradle is like that
You mix imperative and declarative to apply gradle plugin.
Please follow this guide and ensure there is no more mixing:
https://docs.flutter.dev/release/breaking-changes/flutter-gradle-plugin-apply
And to apply correctly the gms plugin:
Remove dependencies section from your android/build.gradle
android/settings.gradle
android/app/build.gradle
You can find the complete migration here: https://docs.flutter.dev/release/breaking-changes/flutter-gradle-plugin-apply#google-mobile-services-and-crashlytics