Android Studio运行Flutter应用时无法找到x86模拟器如何解决?
回答
Hey there, I’ve dealt with this exact quirky issue before—let me walk you through the fixes that got it working for me:
1. Fix the Emulator Path in Environment Variables
The root cause here is usually that Flutter can’t locate the emulator binary when launched from Android Studio, even though your terminal can find it just fine. Here’s how to fix it:
- Open your shell config file (
.bash_profile,.zshrc, or.bashrcdepending on which shell you use) in a text editor. - Add this line to the file:
export PATH="$PATH:/Users/$USER/Library/Android/sdk/emulator" - Save the file, then run
source ~/.bash_profile(or the path to your specific config file) to apply changes right away. - Restart Android Studio, and Flutter should now pick up the emulator correctly.
2. Verify Android Studio’s SDK Configuration
Double-check that Android Studio is using the same SDK location as your terminal:
- Go to
Android Studio > Preferences > Appearance & Behavior > System Settings > Android SDK - Confirm the
SDK Locationis set to/Users/$USER/Library/Android/sdk(the same path you use in your terminal command) - If it was pointing to a different location, update it and restart the IDE.
3. Update Flutter and Plugins
Your Flutter version (0.3.2 beta) is pretty outdated—newer stable versions have fixed tons of Android Studio integration bugs:
- Run these commands in your terminal to switch to stable channel and upgrade:
flutter channel stable flutter upgrade - Also, update the Flutter and Dart plugins in Android Studio: Go to
Preferences > Plugins, search for Flutter/Dart, install any available updates, then restart the IDE.
4. Confirm Flutter SDK Path in Android Studio
Make sure Android Studio has the correct path to your Flutter SDK:
- Go to
Android Studio > Preferences > Languages & Frameworks > Flutter - Check that the
Flutter SDK pathis accurate. If not, browse to your Flutter installation directory and select it. - You can also click the
Flutter doctorbutton here to re-run diagnostics and catch any hidden issues.
One of these steps should get your emulator launching from Flutter projects in Android Studio again. Let me know if you hit any roadblocks!
内容的提问来源于stack exchange,提问作者XY6

