'Android 11 SSL handshake fails when using Charles Proxy

Unable to use Charles Proxy with Android devices since the update to 11. I've read the Configure CAs for debugging page and verified that the app I'm testing is set up per their instructions. This isn't a problem with iOS running the same app. It seems to only be an Android issue.

I can access the internet when proxying through Charles on Android which to me means the connection is good but when I go to use the app that's when things start to fail.

I'm mostly wondering if anyone else is experiencing this issue? If I can isolate my experience I can hopefully use that rationale to get this issue fixed.



Solution 1:[1]

From Android 11, or later, there are new configs in order to make Charles Proxy work:

  1. Verify that you install & trust Charles Proxy certificate. You can verify in Settings app -> Security -> Encryption & Credentials -> Trusted Credentials -> User Tab => Make sure Charles Proxy is loaded.

  2. You're only able to intercept SSL Proxying from your own app, not other apps.

  3. In your source code, add res/xml/network_security_config.xml

<network-security-config>
    <debug-overrides>
        <trust-anchors>
            <!-- Trust user added CAs while debuggable only -->
            <certificates src="user" />
            <certificates src="system" />
        </trust-anchors>
    </debug-overrides>
    
    <base-config cleartextTrafficPermitted="true">
        <trust-anchors>
            <certificates src="system" />
        </trust-anchors>
    </base-config>

    <domain-config>
        <!-- Make sure your URL Server here -->
        <domain includeSubdomains="true">your_production_domain</domain>
        <trust-anchors>
            <certificates src="user"/>
            <certificates src="system"/>
        </trust-anchors>
    </domain-config>
</network-security-config>

=> Replace your_production_domain with your working domain.

  1. Add to AndroidManifest.xml
<manifest>
    <application android:networkSecurityConfig="@xml/network_security_config">
    </application>
</manifest>

Read more at https://docs.proxyman.io/debug-devices/android-device

Solution 2:[2]

Thank's for shared but at step 3 "In your source code, add res/xml/network_security_config.xml" I don't understand. Sorry because i'm fresher :( Can you explain for me :(.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Nghia Tran
Solution 2 MD Cancel