Android模拟器代理设置 [英] Android emulator proxy setting

查看:485
本文介绍了Android模拟器代理设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试设置网络代理以查看仿真器流量.

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:

  1. 在启动仿真器时将-http-proxy http://192.168.x.x:yyyy作为标志传递. 有关如何执行此操作的详细信息,请参见此处.
  2. 在仿真器中为代理配置Access Point设置.为此,请转到设置-> 更多-> 蜂窝网络-> 接入点名称并进行编辑现有的接入点.
  3. 最后,在Developer Settings中有一个设置,用于将设备配置为使用旧版DHCP客户端而不是新版DHCP客户端.必须将其配置为使用旧版.
  4. 打开和关闭Airplane模式.
  1. 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.
  2. 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.
  3. 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.
  4. Toggle Airplane mode on and off.

这篇关于Android模拟器代理设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆