Android Studio中Flutter Create Command执行失败,原因及新项目创建方法?
Hey there! Sorry to hear you're stuck with the "Flutter Create Command was Unsuccessful" error—especially since you already have a working Flutter project, so we know your core setup isn't completely broken. Let's walk through the most common causes and fixes to get you up and running with a new project.
Common Reasons for the Error
- Corrupted or outdated Flutter SDK cache: Even if your existing project runs, the template files or cached dependencies needed to create a new project might be damaged.
- Permission issues: If you're trying to create the project in a system-protected directory (like
C:\Program Fileson Windows or/Systemon Mac), Flutter won't have write access to generate project files. - Network problems: Creating a new project requires pulling template assets and dependencies from Flutter's servers. Unstable internet or regional restrictions can block these downloads.
- IDE configuration glitches: If you're using Android Studio or VS Code, outdated plugins, incorrect Flutter SDK path settings, or cached IDE state might interfere with the
flutter createcommand. - SDK version conflicts: Your existing project might work with an older Flutter version, but your current SDK has bugs or incompatibilities that break project creation.
Step-by-Step Fixes
- Run
flutter createdirectly in the terminal first: IDEs often hide detailed error messages. Open your terminal, navigate to a directory you own (e.g.,cd ~/Documents/FlutterProjectson Mac,cd C:\Users\YourName\FlutterProjectson Windows), then run:
The terminal output will show exactly where the command fails—this is the fastest way to pinpoint the issue.flutter create my_new_project - Repair Flutter's cached dependencies: Run these commands to clean and fix any corrupted cache:
Try creating the project again after this completes.flutter clean flutter pub cache repair - Verify directory permissions: Make sure the folder you're creating the project in has full read/write access for your user account. Avoid system directories or folders that require admin rights. If you already tried in a restricted spot, move to a user-owned directory and retry.
- Fix network issues (for regional users): If you're in a region where Flutter's default servers are inaccessible, configure the official Flutter China mirror:
Then run# Mac/Linux (add to your shell config file for permanent use) export PUB_HOSTED_URL=https://pub.flutter-io.cn export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn # Windows Command Prompt set PUB_HOSTED_URL=https://pub.flutter-io.cn set FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn # Windows PowerShell $env:PUB_HOSTED_URL="https://pub.flutter-io.cn" $env:FLUTTER_STORAGE_BASE_URL="https://storage.flutter-io.cn"flutter createagain. - Adjust your Flutter SDK version:
- Update to the latest stable release:
flutter upgrade - If the latest version is broken, downgrade to the version your existing project uses (replace
3.13.0with your project's version):flutter downgrade 3.13.0
- Update to the latest stable release:
- Reset your IDE configuration:
- Check that your IDE's Flutter SDK path matches the one in your terminal (run
which flutteron Mac/Linux orwhere flutteron Windows to confirm). - Update the Flutter and Dart plugins to their latest versions.
- Restart your IDE to clear any cached state.
- Check that your IDE's Flutter SDK path matches the one in your terminal (run
- Reinstall Flutter as a last resort: If nothing else works, back up your existing projects, uninstall your current Flutter SDK, download the latest stable version, set up your environment variables again, and try creating a project.
内容的提问来源于stack exchange,提问作者Qasim Ali
相关产品推荐
相关产品推荐

