React Native执行npx react-native start后Android Studio模拟器无响应问题
npx react-native start Hey there, let's work through this issue together—it's one of the most common hiccups when getting started with React Native, so you're not alone! Here's a step-by-step breakdown of things to check:
First, verify your emulator is connected properly
Make sure your Android Studio emulator is fully booted (you see the home screen). Pop open a terminal and runadb devices—you should see your emulator listed here. If it's missing, restart the adb server with:adb kill-server adb start-serverThen check
adb devicesagain to confirm it shows up.Check if Metro is running without errors
When you runnpx react-native start, keep an eye on the terminal for any red error messages. A common culprit is a port conflict (default 8081 is often used by other apps). If you see a port error, start Metro on a different port:npx react-native start --port 8088Then, in your emulator, press
Ctrl+M(Windows/Linux) orCmd+M(Mac) to open the dev menu, select "Change Bundle Location", and enterhttp://localhost:8088/index.bundlebefore reloading.Wipe cache and reinstall dependencies
Sometimes stale cache or wonky dependencies cause this. Stop the Metro server first, then run these commands in order:npx react-native clean npm install npx react-native run-androidUsing
run-androidinstead of juststartensures the app is properly compiled, installed, and connected to Metro automatically—this often fixes unresponsive emulator issues.Test emulator network access to Metro
Your emulator needs to reach the local Metro server. Open the emulator's browser and try loadinghttp://localhost:8081/index.bundle(use your custom port if you changed it). If it fails, check the emulator's network settings—make sure no proxy is blocking local requests. You can also try toggling "Debug JS Remotely" in the dev menu to force a connection.Double-check your environment setup
Confirm your Android SDK/NDK versions match the requirements for your React Native version. Also, ensureANDROID_HOMEorANDROID_SDK_ROOTenvironment variables are set correctly. If you're on an older React Native version, updating to the latest stable release might help:npm install react-native@latest(Just make sure to back up your project first to avoid compatibility surprises!)
If none of these steps work, share the exact error messages from your Metro terminal and the output of adb devices—that'll help narrow down the problem even more.
内容的提问来源于stack exchange,提问作者Onur Yüksekkaya

