问题
need to run emulator with proxy settings , I am using the following command in command prompt to start emulator
emulator -avd AVD_for_3_7_WVGA_Nexus_One -http-proxy http://username:password@IP:Port
Without http-proxy switch it is working fine , where as using the http-proxy following error occured :
FATAL:.//android/base/sockets/SocketWaiter.cpp:89:Check failed: isValidFd(fd). fd 1404 max1024
回答1:
I'm experiencing the exact same issue.
Luckily there is a workaround and I can say it's working (at least in my case): adding the -no-audio
parameter to the command:
emulator -avd <device_name> -no-audio -http-proxy http://<username:password@>IP:Port
edit: even if it's working for you, please star the bug to get it fixed!
回答2:
For some reason Android Emulator doesn't like IP address as the proxy. If you are using Fiddler use localhost:8888
:
emulator.exe -avd Nexus_5_API_21_x86 -no-audio -http-proxy localhost:8888
Don't forget -no-audio
parameter too.
回答3:
Adding "-http-proxy none" (without quotes) in Run configuration also fixes this issue as shown in image attached. Please note this is one way of fixing this issue. Your app may not be able to connect to internet via proxy later on.

回答4:
All solutions above was unable to fix my case. For me proxy settings was required, so disabling a proxy parameter does not fit to me. The only solution that helps me is to disable "Use Host GPU" option in the emulator options. Adding "-no-audio" parameter is also required.
And it works! Slowly, but works.
回答5:
It still doesn't work. Please star this bug report so we can get it fixed - I already suggested to modify FD_SETSIZE from winsock.h to higer value e.g. 2048 as it doesn't change windows socket implementation as per microsoft's documentation:
// Default FD_SETSIZE is 64 which is not enough for us.
# define FD_SETSIZE 1024
https://code.google.com/p/android/issues/detail?id=102361
回答6:
This problem is really frustrating. It would be nice if fixed targeting real root because most of the configurations are behind proxy now-a-days.
I observed while researching on this problem for last couple of weeks that emulator is not stable when it comes to http-proxy.
I installed android-studio-bundle-141.2422023-windows on one of the other m/c on that although proxy settings worked nice for http sites but failed for https sites.
On my m/c it didn't work. I tried with all the options listed online like -no-audio or setting from APN(emulator setting), or various versions of using -http-proxy. But none is working for me.
This is still a bug in android emulator refer link - https://code.google.com/p/android/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Status%20Priority%20Owner%20Summary%20Stars%20Reporter%20Opened&groupby=&sort=&id=102361
回答7:
Problem was fixed on latest Android SDK Tools (at the time of writing is in preview). You need version 25+ in order to get the new emulator which doesn't have this problem anymore.
来源:https://stackoverflow.com/questions/26484133/android-emulator-with-proxy-settings-error-fatal-android-base-sockets-chec