Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android emulator network config

So I have set up charles proxy to monitor traffic that goes out of the android emulator.

Now when I open a website it in the Android browser For eg:- google.com I see google.com in charles proxy.

But when I open an app(say instagram app) in the emulator and if the app makes some network calls , I see ip addresses on charles proxy and not domain names.

Because of which the app gives me an error of something went wrong etc.

Can anyone tell me how to change the dns configs of the android emulator so that it sends hostnames instead of IP addresses?

Or any other solution to this problem.

Thanks

like image 414
azero0 Avatar asked Dec 23 '15 14:12

azero0


1 Answers

you can configure a proxy from the command line with the -http-proxy option when starting the emulator. In this case, you specify proxy information in in one of these formats:

http://<machineName>:<port> 

or

http://<username>:<password>@<machineName>:<port> 

The -http-proxy option forces the emulator to use the specified HTTP/HTTPS proxy for all outgoing TCP connections. Redirection for UDP is not currently supported.

Alternatively, you can define the environment variable http_proxy to the value you want to use for . In this case, you do not need to specify a value for in the -http-proxy command — the emulator checks the value of the http_proxy environment variable at startup and uses its value automatically, if defined.

You can use the -debug-proxy option to diagnose proxy connection problems.

You can get further detail about this topic here:

https://developer.android.com/studio/run/emulator-networking.html 
like image 199
ocean hancock Avatar answered Oct 09 '22 21:10

ocean hancock