androidandroid-emulatorhttp-toolkit

http-toolkit : Connection aborted even though I'm using the security config


Edit:

I installed the http toolkit on my machine, and using an android in a device emulator. I followed the official http toolkit guide, created network_security_config.xml file, added it to AndroidManifest.xml, and installed the CA certificate, but I keep getting connection aborted messages for my app.

Not really sure what to do or how to even debug it. Any tips/guides will be great!

The guide: https://httptoolkit.com/docs/guides/android/#if-you-dont-have-a-custom-network-security-config

The network security file is just the same as that guide, didn't have anything before. Using flutter, but it's just java - nothing special about it.

Note: I'm using an emulator with google play so I can't use the system CA, as written in the http toolkit guide

Adding screenshots of the http toolkit app on the device.

enter image description here enter image description here


Solution

  • This is due to Flutter, which ignores external certificate configuration (on Android and all systems, as far as I'm aware). https://github.com/flutter/website/issues/2472 has more details, and there are plenty of related issues like https://github.com/flutter/flutter/issues/140737 that closely match your setup here.

    To resolve this in the short term, you'll need to modify the certificate trust within your Flutter app directly, since network_security_config will be ignored. In the long term, this is a Flutter bug and you should pressure them to correctly follow the system settings.