Android Studio虚拟设备报错:adb rejected shell command (getprop) closed求助
Hey there, sorry to hear you’ve been stuck with this frustrating adb issue for a week—let’s walk through some targeted fixes that might resolve this, since the usual SDK updates and device restarts haven’t worked:
Reset the ADB server completely: Sometimes adb processes hang in the background even after restarting the emulator. Open your terminal and run:
adb kill-server adb start-serverAlso, check your task manager (Windows) or activity monitor (Mac) for any lingering
adboremulatorprocesses, and end them manually before restarting the server.Wipe your emulator’s data: Corrupted emulator cache can break adb communication. Open the AVD Manager, find your problematic device, click the dropdown menu next to it, select Wipe Data, then restart the emulator.
Test with a fresh emulator instance: Your current device’s system image might be faulty. Create a new virtual device using the default configuration (try a different API level if possible) and see if the error persists. If the new emulator works, the issue was with your original device setup.
Check for port blocking: Local firewalls or antivirus tools often block adb’s default port (5037). Temporarily disable your security software and test the emulator again to rule this out.
Verify Android Studio’s adb path: Make sure the IDE is using the correct adb executable from your SDK. Go to File > Settings > System Settings > Android SDK > SDK Tools to confirm the adb location. Try running
adb shell getpropdirectly from that path in your terminal—if this command fails, your adb or system image might be corrupted.Invalidate Android Studio’s cache: IDE cache corruption can cause unexpected adb issues. Go to File > Invalidate Caches..., select Invalidate and Restart, and let the IDE reload before testing the emulator again.
Reinstall the system image: If all else fails, delete the system image for your emulator from the SDK Manager, then download and reinstall it. Corrupted image files are a common culprit for persistent adb errors.
Hope one of these steps gets you past that error—fingers crossed!
内容的提问来源于stack exchange,提问作者Ratnadeep

