问题描述
我正在尝试设置网络代理以查看仿真器流量.
I am trying to set up a network proxy to view emulator traffic.
现在,如果我更改了模拟器的网络设置(10.0.2.2:< port>),一切正常.但是,如果我尝试使用 emulator -avd myAvd -http-proxy localhost通过命令行设置代理服务器:<端口> ,则SSL流量无法通过,并且出现超时错误.
Now if I make a change in network settings of emulator ( 10.0.2.2:< port >, things work fine.But if I try to set the proxy through command line using emulator -avd myAvd -http-proxy localhost:< port > , SSL traffic does not go through and I get time out errors.
有人能做到这一点吗?
谢谢
推荐答案
不确定使用的是哪个模拟器,但是new
Android Studio 2中宣布的Android模拟器存在问题-
Not sure which emulator you are using, but there is an issue with new
Android emulator announced with Android Studio 2 - Bug Tracker
要解决此问题,我必须使用设置为API 23的new
模拟器执行以下操作:
To get a workaround, I had to do the following using the new
emulator set to API 23:
- 在启动仿真器时将
-http-proxy http://192.168.x.x:yyyy
作为标志传递. 有关如何执行此操作的详细信息,请参见此处. - 在仿真器中为代理配置
Access Point
设置.为此,请转到设置-> 更多-> 蜂窝网络-> 接入点名称并进行编辑现有的接入点. - 最后,在
Developer Settings
中有一个设置,用于将设备配置为使用旧版DHCP客户端而不是新版DHCP客户端.必须将其配置为使用旧版. - 打开和关闭
Airplane
模式.
- Pass
-http-proxy http://192.168.x.x:yyyy
as a flag when you are launching the emulator. For details how to do this, see here. - Configure the
Access Point
settings for the proxy within the emulator. To do this, you go to settings->more->cellular network->access point names and edit the existing Access Point. - Finally, there is a setting in
Developer Settings
for configuring the device to use the legacy DHCP client instead of the new one. This must be configured to use the legacy one. - Toggle
Airplane
mode on and off.
这篇关于Android模拟器代理设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!