简体   繁体   English

如何在Windows上使用最新的Android模拟器配置像Fiddler2或Charles Web Proxy这样的HTTP代理?

[英]How to configure an HTTP Proxy like Fiddler2 or Charles Web Proxy with the latest Android Emulator on Windows?

I'm at complete odds over configuring a proxy to inspect the HTTP(S) traffic for the app I'm developing. 我完全没有配置代理来检查我正在开发的应用程序的HTTP(S)流量。 I've tried running Fiddler2 and Charles Web Proxy, both run on 127.0.0.1:888, and starting up the Android emulator with the parameter: 我已经尝试运行Fiddler2和Charles Web Proxy,两者都在127.0.0.1:888上运行,并使用参数启动Android模拟器:

-http-proxy http://127.0.0.1:8888

To test it out I open the Android browser. 为了测试它我打开Android浏览器。 I see in Fiddler2 that the request is routed through the proxy. 我在Fiddler2中看到请求是通过代理路由的。 However, only RARELY does the request receive a successful response. 但是,只有RARELY请求才会收到成功的响应。 In most, and when I say most I mean 99% of the time, the request is retried and fails again with the Android browser telling me "The server failed to communicate". 在大多数情况下,当我说大多数时候我的意思是99%的时候,请求被重试并再次失败,Android浏览器告诉我“服务器无法通信”。

Has anyone found a way to configure Fiddler2 or Charles for debugging HTTP(S) traffic through the Android emulator? 有没有人找到一种方法来配置Fiddler2或Charles来调试通过Android模拟器的HTTP(S)流量?

The -http-proxy emulator option works for me (with a real HTTP proxy behind it), so not sure what the problem with Charles would be. -http-proxy模拟器选项适用于我(后面有一个真正的HTTP代理),因此不确定Charles的问题是什么。

An alternative is to capture the network traffic directly , then analyse it afterwards using Wireshark — which can do SSL decryption, if you have the private key. 另一种方法是直接捕获网络流量 ,然后使用Wireshark进行分析 - 如果你有私钥,它可以进行SSL解密。

I was able to view the traffic with an HTTP sniffer instead of a proxy. 我能够使用HTTP嗅探器而不是代理来查看流量。 I used HTTPScoop, which is a nice little app. 我使用了HTTPScoop,这是一个不错的小应用程序。

Also the nice thing about using HTTPScoop is that I can also see traffic on my actual device when I turn on internet sharing and have my phone use the wifi from my mac. 使用HTTPScoop的好处还在于,当我打开互联网共享并让我的手机使用我的mac上的wifi时,我还可以在我的实际设备上看到流量。 So this is a good deal for debugging what happens on the phone itself AND the emulator. 所以这对于调试手机本身和模拟器上发生的事情是一个很好的协议。

This way it doesn't matter what emulator you use, because the sniffer sees the traffic independent of the emulator, device, compiler settings etc. 这样,使用什么模拟器并不重要,因为嗅探器看到的流量独立于模拟器,设备,编译器设置等。

I had the same problem with Charles using the Emulator from the Android development tools r12. 我使用Android开发工具r12中的模拟器时遇到了同样的问题。 It should be working when you download r11 and replace the emulator in r12 with the one from r11. 它应该在您下载r11并将r12中的仿真器替换为r11中的仿真器时工作。 The bug is tracked here . 这里会跟踪错误。

To get r11 copy the download link from the download page and change r12 to r11. 要从下载页面获取r11副本下载链接并将r12更改为r11。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 Windows 上使用 Charles Web Proxy 和最新的 Android Emulator 配置 SSL 证书? - How to configure SSL certificates with Charles Web Proxy and the latest Android Emulator on Windows? 如何使用Charles Proxy设置Android Lollipop模拟器? - How to setup Android Lollipop emulator with Charles Proxy? 如何使用Charles Proxy分析来自Android 6模拟器的https流量 - How to analyze https traffic from Android 6 emulator with Charles Proxy Android 模拟器无法信任 Charles 代理证书 - Android emulator is not able to trust Charles proxy certificate Android 9(Pie)-无法通过查尔斯代理和Fiddler等网络监视工具捕获任何api(本机/网络) - Android 9 (Pie) - Not able to capture any api (native / web) through network monitoring tools such Charles proxy and Fiddler 不能将 Fiddler 代理与 Android 仿真器一起使用 - Can not use Fiddler proxy with Android Emulator Fiddler代理无法与Android Lollipop模拟器一起使用 - Fiddler Proxy Not Working with Android Lollipop Emulator 无法在Android中配置Fiddler代理来解密HTTPS - Cannot configure Fiddler proxy in Android to decrypt HTTPS 查尔斯代理 + 安卓 HTTPS - Charles Proxy + Android HTTPS com.android.volley.NoConnectionError - 使用Charles Proxy的Android模拟器 - com.android.volley.NoConnectionError - Android emulator with Charles Proxy
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM