26

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
Divesh Pal
  • 439
  • 1
  • 5
  • 16

7 Answers7

57

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!

ph0b
  • 14,353
  • 4
  • 43
  • 41
6

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.

Pavel Chuchuva
  • 22,633
  • 10
  • 99
  • 115
2

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.

enter image description here

Vinay Kadalagi
  • 1,315
  • 1
  • 8
  • 11
  • The whole point is this error is seen only with a proxy details when fed in and `-no-audio` does the job – zIronManBox Jul 02 '15 at 06:20
  • @zIronManBox You are right.. My way is one way of fixing this issue if someone does not want to get blocked for using proxy details. – Vinay Kadalagi Dec 07 '15 at 11:00
1

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.

Subtle Fox
  • 612
  • 7
  • 7
  • 2
    Disabling "Use host gpu" helped (emulator started with proxy settings), but because of other problems I can only see black screen... When I enable "Use host gpu", emulator is working but setting proxy is impossible... – liquide Oct 07 '15 at 15:21
1

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

damian1baran
  • 1,307
  • 1
  • 14
  • 13
1

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

0

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.

haimlit
  • 2,572
  • 2
  • 22
  • 26