An Expo config plugin that copies a custom network security config into your Android app. This is useful when you need to allow HTTPS interception for tools like Proxyman on Android.
| Android Device | Android Emulator | iOS Device | iOS Simulator | Web |
|---|---|---|---|---|
| ✅ | ✅ | ❌ | ❌ | ❌ |
npx expo install expo-network-security-configRequires Expo SDK 50+.
-
Create your
network_security_config.xmlfile somewhere in your project (e.g.assets/configs/network_security_config.xml). -
Add the plugin to the
pluginsarray in yourapp.json(orapp.config.js):
{
"plugins": [
[
"expo-network-security-config",
{
"networkSecurityConfig": "./assets/configs/network_security_config.xml",
"enable": true
}
]
]
}- Run prebuild to regenerate the native project:
npx expo prebuildThe plugin copies your XML file into android/app/src/main/res/xml/ and adds android:networkSecurityConfig to AndroidManifest.xml.
The following example allows Proxyman to intercept HTTP/HTTPS requests by trusting user-added CAs:
<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" />
<certificates src="user" />
</trust-anchors>
</base-config>
</network-security-config>| Parameter | Description |
|---|---|
networkSecurityConfig |
Path to your network_security_config.xml file, relative to the project root. |
enable |
When true, the config is copied and applied. When false (or omitted), the plugin is skipped. |