需要root
1.从Charles导出证书
help-->SSL...-->Save Charles...
2.获取证书hash,并修改证书文件名为hash+后缀''.0'' 。本例为fc0dd2c8.0
安装open ssl(http://slproweb.com/products/Win32OpenSSL.html),然后配置环境变量
在cmd中---> openssl x509 -subject_hash_old -in <Certificate_File> #文件路径为绝对路径
执行结果:fc0dd2c8
3.连接测试机,adb shell 修改 /system权限,
adb push fc0dd2c8.0 /system/etc/security/cacerts/
如果remount或push失败,需要执行以下命令
adb disable-verity
adb reboot
mount -o rw,remount /system
4.修改证书权限为664,重启设备
cd /system/etc/security/cacerts/
chmod 664 ./fc0dd2c8.0
reboot