Search code examples
androidsslcharles-proxyrequest-response

Charles Proxy not working for Android version above 7.0?


I am using Charles for intercepting request and response from a long time,but When I tried google pixel targeting Android Oreo, It keep giving me hand-shake exception. I was aware their certain changes has been done in Naught about network security. Any sort of help will be appreciated.


Solution

  • If you are facing issue using Charles on Device tar-getting above 7.0 in Android, follow these steps, as detailed in the Charles Proxy documentation

    1. Add following line

      android:networkSecurityConfig="@xml/network_security_config"> 
      

      to your manifest file in Application Tag.

    2. Create a xml folder with a file named network_security_config and paste following code in it.

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

    Note: Do not commit above to your branch if you have only single build flavours.

    For People having different build flavours (debug/release/other) can use this for debug version and commit as well.