【问题标题】:Flutter - Could not find a command named "-"Flutter - 找不到名为“-”的命令
【发布时间】:2021-05-20 09:40:06
【问题描述】:

我是flutter的新手,当我创建了一个新的flutter项目并运行它时,会出现:

Using hardware rendering with device AOSP on IA Emulator. If you notice graphics artifacts,
consider enabling software rendering with "--enable-software-rendering".
Launching lib\main.dart on AOSP on IA Emulator in debug mode...
Could not find a command named "-".

Usage: dart [<vm-flags>] <command|dart-file> [<arguments>]

Global options:
-h, --help                 Print this usage information.
-v, --verbose              Show additional command output.
    --version              Print the Dart SDK version.
    --enable-analytics     Enable anonymous analytics.
    --disable-analytics    Disable anonymous analytics.

Available commands:
  analyze   Analyze the project's Dart code.
  compile   Compile Dart to various formats.
  create    Create a new project.
  fix       Apply automated fixes to Dart source code.
  format    Idiomatically format Dart source code.
  migrate   Perform a null safety migration on a project or package.
  pub       Work with packages.
  run       Run a Dart program.
  test      Run tests in this package.

Run "dart help <command>" for more information about a command.
See https://dart.dev/tools/dart-tool for detailed documentation.
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done                        510ms
Exception: Gradle task assembleDebug failed with exit code 64

我被这个问题困住了,如何解决这个问题?

【问题讨论】:

  • 我在颤振医生 -v 中没有发现任何问题
  • 你输入的是什么命令?
  • @ScottGodfrey 当我尝试在 cmd 或 vscode 中“flutter run”时出现此问题
  • 尝试flutter clean,然后flutter run
  • @ScottGodfrey 还是一样

标签: flutter dart gradle


【解决方案1】:

我已经解决了这个问题。我在我的 D: 目录中运行这个项目,而我的颤振和 android SDK 安装在 C: 目录中。因此,当我尝试在 C: 中创建颤振项目时,它起作用了。但是,我仍然无法配置为什么会出现这个问题。

【讨论】:

    【解决方案2】:

    @Papskipapap 我可以问一下,如果在 D: 上运行你的项目还包含一些包含“-”(破折号)的路径名?根据经验:保持路径名简单,即没有空格或除“_”(下划线)以外的特殊字符,许多工具无法处理这些......

    【讨论】:

      猜你喜欢
      • 2022-01-18
      • 1970-01-01
      • 1970-01-01
      • 2019-07-14
      • 1970-01-01
      • 2014-10-08
      • 2016-01-13
      • 2021-11-16
      • 1970-01-01
      相关资源
      最近更新 更多