Android Studio初始化ADB后无设备显示,重启后设备消失求助
Hey there, let's break down why your Android Studio can't detect any devices (virtual or physical) after initializing ADB and restarting, showing that "Nothing to show" message. I've run into similar headaches before, so here are the most likely culprits to check:
ADB's background daemon process can freeze up unexpectedly, especially after initialization. A quick restart usually fixes this:
- Open your terminal/command prompt and run
adb kill-serverto shut down the stuck daemon - Follow it up with
adb start-serverto restart fresh - Check Android Studio again—this simple fix resolves the "Nothing to show" issue more often than you'd think.
If you're using a physical Android device, driver issues are a common culprit:
- Double-check that USB Debugging is enabled in your device's Developer Options (you'll need to tap the Build Number 7 times in Settings > About Phone to unlock this menu first).
- Ensure your computer has the correct OEM drivers installed. For example, Samsung devices need Samsung USB Drivers, Google Pixels use the Google USB Driver, etc. Outdated or missing drivers prevent your OS from recognizing the device, so ADB can't pick it up either.
- On Linux, you might need to set up udev rules for your device—many distros block USB access to Android devices by default unless you add the appropriate permission rules.
If your virtual devices vanished too, their underlying files might be corrupted:
- Head to Tools > Device Manager, select the missing AVD, click the dropdown menu, and choose Delete. Then create a new AVD with the same specs—fresh files often fix the detection issue.
- Also verify that the Android Emulator is running properly. Check your task manager (Windows) or activity monitor (macOS) for
qemu-system-*processes. If they're missing, try launching the emulator directly from the Device Manager to see if it throws an error message.
Sometimes the IDE's cached settings get messed up:
- Invalidate caches and restart Android Studio: Go to File > Invalidate Caches..., check all the boxes, then click Invalidate and Restart. This clears any corrupted cached data that might be blocking device detection.
- Double-check your Android SDK path in File > Project Structure > SDK Location. If the path is incorrect or SDK files are corrupted, ADB won't function properly.
ADB uses port 5037 by default. If another program is hogging this port, ADB can't communicate with devices:
- On Windows, run
netstat -ano | findstr :5037in Command Prompt to find the process using the port, then end it in Task Manager. - On macOS/Linux, run
lsof -i :5037to locate the process, then usekill -9 <PID>to terminate it. - After freeing up the port, restart the ADB daemon as mentioned earlier.
Don't overlook the simple stuff:
- Try a different USB cable—many cheap cables only support charging, not data transfer.
- Switch to a different USB port on your computer. Front-panel ports often have weaker connectivity or power issues compared to rear ports.
- On your device, make sure the USB connection mode is set to File Transfer (MTP) or PTP—some devices default to "Charging only," which blocks ADB access.
内容的提问来源于stack exchange,提问作者user6527938

