5

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.

ankuranurag2
  • 2,300
  • 15
  • 30
roger_that
  • 9,493
  • 18
  • 66
  • 102

2 Answers2

8

Steps

  1. Create an xml folder in your application's res folder.

  2. Add a file named network_security_config.xml in the xml folder with the following contents:

    <?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 the network_security_config.xml file in the application tag in your AndroidManifest.xml file, as follows:

    <application
        ...
        android:networkSecurityConfig="@xml/network_security_config"
        ...
    
Adil Hussain
  • 30,049
  • 21
  • 112
  • 147
portfoliobuilder
  • 7,556
  • 14
  • 76
  • 136
0

As of 2022 adding just the following in network_security_config.xml worked for me.

<network-security-config>
    <debug-overrides>
        <trust-anchors>
            <certificates src="user" />
        </trust-anchors>
    </debug-overrides>
</network-security-config>

the same is explained in docs as well. https://www.charlesproxy.com/documentation/using-charles/ssl-certificates/

after doing the above you will still have to refer the xml file in manifest

<application
    ...
    android:networkSecurityConfig="@xml/network_security_config"
    .../>
Aniruddha K.M
  • 7,361
  • 3
  • 43
  • 52