Charles proxy in non debuggable flavour of Android app-ThrowExceptions

Exception or error:

First of all let me clarify that I know that this is a very bad practice and I will not push this change into my production code. But sometimes we need to debug some changes in non debuggable flavour of my application but all the https urls are failing with the following error

Client SSL handshake failed: An unknown issue occurred processing the certificate (certificate_unknown)

I have used the following network config files and added in my manifest file. This is working in debuggable flavour of the app but still not working in non-debuggable flavour.

<?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>

Is there any way I can use charles to monitor my network calls in the non-debuggable flavour of the android app ?

How to solve:

When creating your release build that needs to debug using Charls, In the Manifest inside the application context. please add android:debuggable="true" after that try to build your release build and try to debug using Charls.
I have not tried this but this might work. According to the following link.
https://developer.android.com/training/articles/security-config.html

###

This one works for me:

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

Source

Leave a Reply

Your email address will not be published. Required fields are marked *