简体   繁体   English

如何使用Charles Proxy设置Android Lollipop模拟器?

[英]How to setup Android Lollipop emulator with Charles Proxy?

I've been following instructions from other questions such as How to configure SSL certificates with Charles Web Proxy and the latest Android Emulator on Windows? 我一直在关注其他问题的说明,例如如何使用Charles Web Proxy和Windows上的最新Android模拟器配置SSL证书? (I'm on a MAC though) and SSL Proxy/Charles and Android trouble and I'm able to use Charles Proxy to analyze the packets of Android emulators all the way up to Kitkat. (我虽然在MAC上)和SSL代理/查尔斯和Android的麻烦 ,我能够使用Charles Proxy分析Android模拟器的数据包一直到Kitkat。

Now I'm trying to do the same for Lollipop emulators. 现在我正在尝试为棒棒糖模拟器做同样的事情。 However, when I repeated the same steps I used to successfully setup the Kitkat emulators, Charles show nothing! 但是,当我重复我用来成功设置Kitkat仿真器的相同步骤时,Charles没有显示任何内容! When I try to connect to the web using the emulator's browser, it gives the following error: 当我尝试使用模拟器的浏览器连接到Web时,它会出现以下错误: 在此输入图像描述

Are there any special steps required for the Android Lollipop emulator on Mac OS X in order to enable packet sniffng? 为了启用数据包嗅探功能,Mac OS X上的Android Lollipop仿真器是否需要特殊步骤?

Thanks in advance! 提前致谢!

I had the same, and finally find a way out: Follow the instruction in the link you mentioned: How to configure SSL certificates with Charles Web Proxy and the latest Android Emulator on Windows? 我有同样的,最后找到出路:按照你提到的链接中的说明: 如何使用Charles Web Proxy和Windows上的最新Android模拟器配置SSL证书?

Then from charles I went into the 'Proxy' menu and enabled 'Mac OS X proxy'. 然后从查尔斯进入“代理”菜单并启用“Mac OS X代理”。 Than suddenly stuff came through. 比突然的东西来了。 Even after I switched off the 'Mac OS X proxy'... 即使在我关闭'Mac OS X代理'之后......

ps: setting the proxy through the mobile settings on the emulator did not work; ps:通过模拟器上的移动设置设置代理不起作用; proxy setting has to be done through the command-line (The emulator command in in the sdk/tools and should be run something like : ./emulator -avd Nexus_4_API_21 -http-proxy http://<your-ip-as-in-charles-help-menu>:8888 ). 代理设置必须通过命令行完成(sdk / tools中的模拟器命令,应该运行如下: ./emulator -avd Nexus_4_API_21 -http-proxy http://<your-ip-as-in-charles-help-menu>:8888 )。 I've also tried some proxy-apps like the proximator without any succes. 我也尝试了一些像proximator这样的代理应用程序而没有任何成功。 Also I've have problems and restarting charles fixed it. 我也有问题,并重新启动查尔斯修复它。

If you don't want to faff around with command line you can do this from the emulator, it requires a bit more setup but works nicely: 如果你不想使用命令行,你可以从模拟器执行此操作,它需要更多的设置,但工作得很好:

  1. Open Settings > More > Cellular Networks > Access Point Names 打开设置>更多>蜂窝网络>接入点名称

在此输入图像描述

  1. Select the main APN and enter the proxy as 10.0.2.2:8888 (Points to your machine localhost) You can use another IP on the network if you are doing it with an actual device or it's on a local device farm. 选择主APN并输入代理10.0.2.2:8888(指向您的计算机localhost)如果您使用实际设备或在本地设备服务器场上,则可以在网络上使用其他IP。

在此输入图像描述

  1. Go to charlesproxy.com/getssl on Chrome 转到Chrome上的charlesproxy.com/getssl

在此输入图像描述

  1. The SSL certificate will download SSL证书将下载

在此输入图像描述

  1. When opening it will ask you to set up a pin or confirm it if you already have it set up 打开时,它会要求您设置一个引脚或确认它是否已经设置好

  2. Name the certificate 为证书命名

在此输入图像描述

  1. Enjoy proxying (you have to enable SSL proxying for your domain on Charles in order to see the requests) 享受代理(您必须在Charles上为您的域启用SSL代理才能查看请求)

Note: I've tested this with an API 24 emulator and seems to work, however it should work with other versions. 注意:我已经使用API​​ 24仿真器对其进行了测试,但似乎可以正常工作,但它应该适用于其他版本。

Note 2: As of Android Studio 3.0 Charles will be no longer needed when using API > 21 for the most part since this is coming: https://developer.android.com/studio/profile/network-profiler.html 注意2:从Android Studio 3.0开始,在大多数情况下使用API​​> 21时将不再需要Charles: https//developer.android.com/studio/profile/network-profiler.html

Now there is a setting in Android emulator 现在Android模拟器中有一个设置 在此输入图像描述

it might be slighly tedious on Mac while debugging on Android emulator. 在Android模拟器上进行调试时,在Mac上可能会非常单调乏味。

Follow the steps: 按照步骤:

1) Open terminal and go to tools folder in SDK path. 1)打开终端并转到SDK路径中的tools文件夹。
2) Drag and drop a file named emulator on the terminal (doing so gives you the path of the executable file). 2)在终端上拖放一个名为emulator的文件(这样做会为您提供可执行文件的路径)。
Your emulator should now read the path like this 您的模拟器现在应该读取这样的路径

/Users/your_pc_name/android_sdk/tools/emulator -avd Nexus_6P_API_23 -http-proxy http://xxxx:8888 / Users / your_pc_name / android_sdk / tools / emulator -avd Nexus_6P_API_23 -http-proxy http:// xxxx:8888

here xxxx is the IP address that you can find in Charles Help menu. 这里xxxx是您可以在Charles Help菜单中找到的IP地址。
3) and execute this. 3)并执行此操作。

Voila! 瞧! Your emulator will now start in proxy networking mode. 您的模拟器现在将以代理网络模式启动。

/Users/`whoami`/Library/Android/sdk/tools/emulator -avd `android list avd | grep Name -m 1 | cut -c 10-99` -http-proxy `ipconfig getifaddr en0`:8888

这应该适用于大多数mac。

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

相关问题 如何使用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 如何在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? Fiddler代理无法与Android Lollipop模拟器一起使用 - Fiddler Proxy Not Working with Android Lollipop Emulator com.android.volley.NoConnectionError - 使用Charles Proxy的Android模拟器 - com.android.volley.NoConnectionError - Android emulator with Charles Proxy 如何在 Windows 上使用 Charles Web Proxy 和最新的 Android Emulator 配置 SSL 证书? - How to configure SSL certificates with Charles Web Proxy and the latest Android Emulator on Windows? 将适用于Android模拟器Eclipse的Charles Proxy与Kindle Fire结合使用 - Using Charles Proxy for Android emulator Eclipse with Kindle Fire Android Emulator:设置代理服务器时如何不代理10.0.2.2? - Android Emulator: How to not proxy 10.0.2.2 when proxy server is setup? 如何让查尔斯代理与 Android 7 牛轧糖一起工作? - How to get charles proxy work with Android 7 nougat? 查尔斯代理 + 安卓 HTTPS - Charles Proxy + Android HTTPS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM