以前有人遇到过这个问题吗?
或者有人有解决方案吗?
我在开始运行 Flutter 程序时遇到了这个问题。我把sdk删了重新下载,没用
Could not find a command named "-".
Usage: dart <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 analytics.
--disable-analytics Disable analytics.
Available commands:
analyze Analyze Dart code in a directory.
compile Compile Dart to various formats.
create Create a new Dart project.
fix Apply automated fixes to Dart source code.
format Idiomatically format Dart source code.
migrate Perform null safety migration on a project.
pub Work with packages.
run Run a Dart program.
test Run tests for a project.
Run "dart help <command>" for more information about a command.
See https://dart.dev/tools/dart-tool for detailed documentation.
Exception: Gradle task assembleDebug failed with exit code 64
Exited (sigterm)
答案 0 :(得分:-2)
解决方法 当 flutter 和 dart sdk 位于 C:\ 目录并且您的项目位于不同的目录(如 D:\ )时,就会发生这种情况。 在 sdks 所在的同一目录中创建项目。
编辑: 如果您遇到问题,则问题是您的 sdk 路径未设置。检查android studio中的sdk路径并设置路径。应该可以。