无法将 firebase 添加到我的 Flutter 项目中

问题描述 投票:0回答:1

当我运行 flutter 项目时,我遇到了这个失败。 我尝试将 firebase 插入我的项目中。 我按照 Firebase 网站的说明做了一切 我不知道我必须做什么。

FAILURE: Build failed with an exception.
Where:
Settings file '/Users/daniilsereda/StudioProjects/translator/android/settings.gradle' line: 29

* What went wrong:
Plugin [id: 'com.google.gms.google-services', version: '4.4.1', apply: false] was not found in any of the following sources:

- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Included Builds (None of the included builds contain this plugin)
- Plugin Repositories (could not resolve plugin artifact 'com.google.gms.google-services:com.google.gms.google-services.gradle.plugin:4.4.1')
  Searched in the following repositories:
    Google
    MavenRepo
    Gradle Central Plugin Repository

我已经尝试了一切,但没有任何效果。

flutter
1个回答
0
投票

根据您的错误并检查您的项目后,我发现缺少一些插件声明。

添加这个

id "com.google.gms.google-services" version "4.4.1" apply false
在你的
settings.gradle

如下:

plugins {
    id "dev.flutter.flutter-plugin-loader" version "1.0.0"
    id "com.android.application" version "7.3.0" apply false
    id "com.google.gms.google-services" version "4.4.1" apply false
}

同时将您的存储库设为私有,您的凭据(例如 Firebase 项目的 api 密钥)在 github 存储库中可见。

© www.soinside.com 2019 - 2024. All rights reserved.