我正在尝试将Firebase Auth添加到我的Android应用程序。当我运行应用程序时,我收到以下错误消息:
A problem occurred configuring root project 'android'.
> Could not resolve all files for configuration ':classpath'.
> Could not find com.google.gms.google-services:4.3.15:.
Required by:
project :
我已经尝试过更新flutter、dart和AndroidStudio。下面是我的build.gradle
(root)的一个片段:
buildscript {
ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.google.gms.google-services:4.3.15'
classpath 'com.android.tools.build:gradle:7.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
下面是build.gradle
(模块)的一个片段:
buildscript {
ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.google.gms.google-services:4.3.15'
classpath 'com.android.tools.build:gradle:7.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
最后,下面是我的pubspec.yaml
:
name: app_layout
description: A new Flutter project.
publish_to:
version: 1.0.0+1
environment:
sdk: '>=2.19.6 <3.0.0'
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
http: ^1.0.0
firebase_core: ^2.13.1
firebase_auth: ^4.6.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.0
flutter:
uses-material-design: true
assets:
- assets/
我还将google-service.json
添加到app目录中。
1条答案
按热度按时间wh6knrhe1#
你打错了。
classpath 'com.google.gms.google-services:4.3.15'
应为classpath 'com.google.gms:google-services:4.3.15'
注意
gms.google
->gms:google
。参见maven。