解决用Charles对Android APP抓包时候出现unknown的问题
1、首先设置proxy>proxy setting> 勾上enable transparent HTTP proxying。

2、安装电脑端证书help>ssl proxying>install Charles Root Certificate

3、在证书页面选始终信任

4、手机端下载证书help>ssl proxying>XXXX Modile Device XXX


5、在手机浏览器访问chls.pro/ssl 自动下载证书。(推荐使用Chrome浏览器)
6、手机和电脑连接同一个网络,在网络的高级设置中填写上图的IP(10.0.69.179:8888)
7、在项目res 下添加xml 文件夹以及network_security_config.xml 文件
内容:
<base-config cleartextTrafficPermitted="true">
<certificates src="system" overridePins="true" />
<certificates src="user" overridePins="true" />
</network-security-config>

8、在manifest 的application节点下添加引用
android:networkSecurityConfig="@xml/network_security_config"

9、打开APP进行网络请求,最后一步在Charles在打开的网址上右键设置 enable SSL proxying ,再次访问刚才的请求就好了。

网友评论