You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

重装Android Studio后Flutter项目提示配置Android SDK的解决方法

Fixing "Please configure Android SDK" in Flutter Project After Reinstalling Android Studio (MacOS Big Sur)

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:

  1. 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 Manager in the top menu
  2. 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's android/app/build.gradle file)
    • Make sure the "Show Package Details" checkbox is checked, then select the SDK Platform for that version
  3. 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)
    • Click Apply to start downloading and installing the selected 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-licenses and follow the prompts to accept all licenses
    • This command will also flag any remaining issues with your Flutter/Android setup

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 (or Android Studio > Settings > Plugins on 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

火山引擎 最新活动