How to add network security configuration to enable Charles proxy SSL in Nougat?

不想你离开。 提交于 2019-12-10 10:04:38

问题


I am trying to enable Charles Proxy SSL on my Samsung s8 running on Android Nougat but don't know how to.

Before Nougat am able to successfully record the charles sessions for multiple apps on my device.

Have followed this and this to set up everything but it's the first step to follow while enabling Charles in Android. My use case is different than those in other questions because am monitoring third party apps and I do not have any AndroidManifest.xml or res directory to create network_configuration files.

Have also gone through the Network Security Configuration and what to do but don't know how.

Is there a way I can enable the proxy for all the third party apps in my device? Any ways to add this network configuration to the device itself and not individual apps?

Appreciate the help.


回答1:


Steps

1) Create xml folder inside your res folder

2) Create file called "network_security_config.xml". Add code

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="true">
        <trust-anchors>
            <certificates src="system"/>
        </trust-anchors>
    </base-config>
    <debug-overrides>
        <trust-anchors>
            <certificates src="user"/>
        </trust-anchors>
    </debug-overrides>
</network-security-config>

3) Reference this file in your AndroidManifest.xml, under the Application tag

android:networkSecurityConfig="@xml/network_security_config"


来源:https://stackoverflow.com/questions/48879181/how-to-add-network-security-configuration-to-enable-charles-proxy-ssl-in-nougat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!