android-studio - 在我的 Assets 上获取 "No file or variants found for asset"发现错误

标签 android-studio flutter dart

尝试运行我的应用程序时,出现此错误。有任何想法吗?
(以下)

Launching lib\main.dart on SM J200Y in debug mode...
Running Gradle task 'assembleDebug'...
√ Built build\app\outputs\apk\debug\app-debug.apk.
Error detected in pubspec.yaml:
No file or variants found for asset: assets/credentials.json.

我已经检查了yaml文件,并且格式似乎还不错。我茫然想要这个问题。 (也如下)
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true
  # To add assets to your application, add an assets section, like this:
  assets:
  - assets/credentials.json

最佳答案

检查 Assets 的缩进。通常,从新行开始应有3个空格。

assets:
 - assets/credentials.json // <-- count three spaces from start

关于android-studio - 在我的 Assets 上获取 "No file or variants found for asset"发现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59657146/

相关文章:

dart - 在 Flutter 中将图像对齐到左上角

flutter - flutter :从小部件中获取小部件的屏幕截图

flutter - 如何 BoxFit.cover 具有特定纵横比的全屏 VideoPlayer 小部件

java - Android:如何使用 if 语句来获取 bundle/Intent 值?

android - 如何以编程方式从 Android 应用程序读取 gradle 文件属性

gradle - 不支持的方法 : GradleProject. getBuildScript()

ios - 如何捕获 Flutter Google 登录 PlatformException?

java - RecycleViewer 没有连接适配器。网址也出错

flutter - 如何格式化表单数据标题的主体

flutter - 我是否必须为一个字段创建getter和setter?