Reputation:
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.
Upvotes: 4
Views: 10480
Reputation: 1144
The other answer is correct as well, but according to the 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>
Upvotes: 0
Reputation: 2947
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
Add following line
android:networkSecurityConfig="@xml/network_security_config">
to your manifest file in Application Tag.
<?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.
Upvotes: 15