重装Android Studio后Flutter项目提示配置Android SDK的解决方法
Hey there, this is a super common hiccup after a fresh Android Studio install, especially when working with Flutter projects. Let's walk through exactly what to do in the Project Structure window and beyond to get this sorted:
Step 1: Set the Android SDK Location in Project Structure
When you're in the Project Structure window (opened via the "configure" button or using the shortcut Cmd + ;):
- On the left sidebar, select SDK Location
- In the "Android SDK Location" field, enter the default SDK path for MacOS:
~/Library/Android/sdk- If you've moved your SDK to a custom location, browse to that folder instead
- Click Apply then OK to save this setting
Step 2: Verify & Install Required SDK Components
Chances are, your fresh install is missing the specific SDK tools and platforms your Flutter project needs. Here's how to fix that:
- Open the SDK Manager—you can either click the link that says "SDK Manager" in the SDK Location tab of Project Structure, or go to
Tools > SDK Managerin the top menu - Go to the SDK Platforms tab:
- Check the box next to the Android version matching your project's
compileSdkVersion(you can find this in your project'sandroid/app/build.gradlefile) - Make sure the "Show Package Details" checkbox is checked, then select the SDK Platform for that version
- Check the box next to the Android version matching your project's
- Switch to the SDK Tools tab:
- Check these essential components:
- Android SDK Build-Tools (match the version specified in your
build.gradle) - Android SDK Platform-Tools
- Android SDK Command-line Tools (latest)
- Android Emulator (if you plan to use a virtual device)
- Android SDK Build-Tools (match the version specified in your
- Click Apply to start downloading and installing the selected components
- Check these essential components:
Step 3: Sync Your Project & Validate Configuration
Once the SDK components are installed:
- Go back to Android Studio and click the Sync Project with Gradle Files button (the elephant icon in the top toolbar)
- After sync completes, open Logcat again— the "Please configure Android SDK" error should be gone
- For an extra check, open Terminal and run
flutter doctor- If you see a prompt about missing Android licenses, run
flutter doctor --android-licensesand follow the prompts to accept all licenses - This command will also flag any remaining issues with your Flutter/Android setup
- If you see a prompt about missing Android licenses, run
Bonus: Ensure Flutter & Dart Plugins Are Installed
Since you reinstalled Android Studio, double-check that the Flutter and Dart plugins are enabled:
- Go to
Settings > Plugins(orAndroid Studio > Settings > Pluginson Mac) - Search for "Flutter" and "Dart"—if they're not installed, click "Install" and restart Android Studio when prompted
That should get your Flutter project up and running without the SDK configuration error!
内容的提问来源于stack exchange,提问作者Harry




