我在android studio上创建了新的Flutter项目。然后我尝试运行它,但它给出了这个错误。我以前的项目运行正常。如果有人能解决这个问题?
Launching lib\main.dart on Redmi Note 9 Pro in debug mode...
Running Gradle task 'assembleDebug'...
'dar' is not recognized as an internal or external command,
operable program or batch file.
Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
Caused by: java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMain
Exception: Gradle task assembleDebug failed with exit code 1
然后尝试flutter run
,结果相同
PS E:\Intern\26-light & dar theme\untitled1> flutter run
Launching lib\main.dart on Redmi Note 9 Pro in debug mode...
'dar' is not recognized as an internal or external command,
operable program or batch file.
Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
Caused by: java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMain
Running Gradle task 'assembleDebug'... 660ms
Exception: Gradle task assembleDebug failed with exit code 1
1条答案
按热度按时间7gyucuyw1#
项目的路径上发生错误:
E:\Intern\26-light & dar theme\untitled1
。此问题是由于文件名26-light & dar theme
中使用了空格而导致的。若要解决此问题,请在文件名中不使用空格的其他位置创建项目。(避免在文件名中使用特殊字符(如“&”),以防止发生错误。最佳做法是在文件名中仅使用字母数字字符和下划线。)