dart 错误:找不到com.google.gms:google-services:4.3.15?

yr9zkbsy  于 2023-06-19  发布在  Go
关注(0)|答案(1)|浏览(224)

我正在尝试将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目录中。

wh6knrhe

wh6knrhe1#

你打错了。
classpath 'com.google.gms.google-services:4.3.15'应为classpath 'com.google.gms:google-services:4.3.15'
注意gms.google-> gms:google
参见maven

相关问题