我在构建手机/Android Ffltter应用程序时遇到了这个问题,请帮助:

[ +271 ms] > Configure project :firebase_core
[        ] Evaluating project ':firebase_core' using build file 'C:\Users\kelsey\AppData\Local\Pub\Cache\hosted\pub.dev\firebase_core-2.4.0\android\build.gradle'.
[        ] Using default execution profile
[        ] Could not execute [class org.jetbrains.kotlin.gradle.plugin.statistics.KotlinBuildStatHandler.buildFinished]
[   +2 ms] FAILURE: Build failed with an exception.
[   +3 ms] * What went wrong:
[        ] A problem occurred configuring project ':firebase_core'.
[   +1 ms] > com.android.builder.errors.EvalIssueException: defaultConfig contains custom BuildConfig fields, but the feature is disabled.
[   +1 ms] * Try:
[   +4 ms] > Run with --debug option to get more log output.
[   +1 ms] > Run with --scan to get full insights.
[        ] * Exception is:
[        ] org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':firebase_core'.

[        ] Caused by: com.android.builder.errors.EvalIssueException: defaultConfig contains custom BuildConfig fields, but the feature is disabled.
[        ]  at com.android.builder.errors.IssueReporter.reportError(IssueReporter.kt:113)

推荐答案

我认为这个问题是由于不推荐使用buildConfigField(来自android.PackageBuildConfig).

try 将以下行添加到gradle.properties:

android.defaults.buildfeatures.buildconfig=true

另外,请注意,在firebase_core包解决问题之前,这是一个临时解决方案.

Flutter相关问答推荐

如何在扩展其他小部件时访问Ref

BlocBuilder仅生成一次,并在后续发出时停止重建

如何在Flutter 中共享选定文本

如何使文本表格域在抖动中变圆?

将列表<;Events>;从Flutter 应用程序中的函数传回EventLoader属性时出错

如何在Ffltter 3.16中设置标准的提升按钮主题?

Flutter如何将2个以上的值传递到ListView上的另一个屏幕?

在Dart中使用Riverpod代码生成时出现问题(addListener)

Flutter 构建 Web 分段故障 - 无法启动事件处理程序线程

如何使自动焦点位于已经有一些文本的 TextField 的第一行?

Flutter Riverpod 没有捕获 List 的嵌套值变化

如何将行推到列的底部

如何与 PostgreSQL 和外部网站交互 flutter apk?

当项目较少时收缩列表视图

Android Studio - Electric Eel 2022.1.1 更新 destruct 了 dart 文件图标

Pub get 尚未运行

如何按值对列表中的 map 进行排序

Banner Ad.test 广告单元 ID 是否已过时?

在 flutter 中使用 Firebase 实时数据库数据创建无限滚动效果

在flutter web中重新加载页面时保留一些状态数据的有效方法是什么?