问题
I have a strange problem which cannot find any fix for it. Every thing is OK for the first time when i open emulator and AVD run normally. but after 5-10 minutes, the emulator disconnect,it lose it's internet connection and i cant connect to it,also the Android Studio completely stuck and nothing happen ! I should close the emulator and after that everything become normal again.
These are what I tested :
adb kill-server
and then
adb start-server
I also tried connecting and disconnecting again
adb connect localhost:5554
and also adb connect emualtor-5554
but still no result.
The worse part is that I can't use Android Studio anymore, even clicking on lines of codes don't work!
Every time I should close the emulator and open it again.
NOTE : I can't use Genymotion, and I don't want to use my device for debugging!
Can any body have any fix for this damn bug. it made me crazy ... thanks in advance
EDIT :
The problem is not something related to emulator. Today I try to debug with WiFi connection. Everything was good for a while till the problem happened again with my real device. In log it said :
deviceXXXXX disconnected
So the problem is with my ADB connection !
What I tested was adding port 5555 to firewall also added ADB to pass through firewall. But still the problem persists.
回答1:
What's your android studio version, jdk version, os?
What api are you targeting?
Can be a problem with new feature of android studio 2 instant run.
First try would be turn in off.
Be aware if you are targeting N Developer Preview is required to use Java 8.
More radical way is to rollback to android studio 1.5 and test.
回答2:
You might need to do these : Wipe user data (emulator)
(install zlib.i686) execute these command,this is common gradle problem and known for crash/freeze of AS
来源:https://stackoverflow.com/questions/36954746/emulator-disconnect-frequently-and-android-studio-stuck-how-to-fix-it