[英]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: 如果你不想使用命令行,你可以从模拟器执行此操作,它需要更多的设置,但工作得很好:
When opening it will ask you to set up a pin or confirm it if you already have it set up 打开时,它会要求您设置一个引脚或确认它是否已经设置好
Name the certificate 为证书命名
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
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.