简体   繁体   中英

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.

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.

The other answer is correct as well, but according tothe documentation the base-config xml tag is not needed at all. While this is not explicitly mentioned, their example does not include that tag.

This is the code on the Documentation site for "Configure CAs for debugging":

res/xml/network_security_config.xml :

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <debug-overrides>
        <trust-anchors>
            <certificates src="@raw/debug_cas"/>
        </trust-anchors>
    </debug-overrides>
</network-security-config>

Instead of specifying a specific certificate, we can just allow user-installed certs though, like in the other answer:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM