admin管理员组文章数量:1122832
FAILURE: Build failed with an exception.
Where: Build file 'C:\Users\ASUS\Documents\fyp\android\build.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.
android/build.gradle
android/app/build.gradle
FAILURE: Build failed with an exception.
Where: Build file 'C:\Users\ASUS\Documents\fyp\android\build.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.
android/build.gradle
android/app/build.gradle
Share Improve this question asked yesterday qadri Waieqadri Waie 211 bronze badge 1- On Stack Overflow, please don't show pictures of text and code. Copy the text into the question itself and format it so that it's easy to read, copy, and search. You can edit the question to correct this using the edit link at the bottom. – Doug Stevenson Commented yesterday
2 Answers
Reset to default 0You can add your compatible version of this codes to the top of android/build.gradle file. Mine is working like that.
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:8.1.0'
classpath 'com.google.gms:google-services:4.4.2'
classpath 'com.google.firebase:firebase-crashlytics-gradle:3.0.2'
}
}
plugins{
id "com.google.gms.google-services" version '4.4.2' apply false
id ("com.google.firebase.crashlytics") version '3.0.2' apply false
}
also settings.gradle is like that
pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}()
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.1.0" apply false
id "org.jetbrains.kotlin.android" version "1.8.22" apply false
id 'com.google.gms.google-services' version '4.4.2' apply false
}
include ":app"
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
plugins {
// ...
id "com.google.gms.google-services" version "4.3.15" apply false
}
android/app/build.gradle
plugins {
// ...
id 'com.google.gms.google-services'
}
You can find the complete migration here: https://docs.flutter.dev/release/breaking-changes/flutter-gradle-plugin-apply#google-mobile-services-and-crashlytics
本文标签: androidcomgooglegmsgoogleservices441 problem how to solveStack Overflow
版权声明:本文标题:android - com.google.gms:google-services:4.4.1 problem. how to solve? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736282555a1926678.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论