eas-cli/2.6.0 darwin-arm64 node-v16.17.1
This was really annoying, I found a workaround but I hope there’s a better way to do this.
The issue: When building a custom development client with EAS Build, we end up with the file
android/app/src/main/res/xml/network_security_config.xml with this content
<?xml version="1.0" encoding="utf-8"?> <network-security-config> <domain-config cleartextTrafficPermitted="true"> <domain includeSubdomains="true">10.0.2.2</domain><domain includeSubdomains="true">localhost</domain> </domain-config> </network-security-config>
android/app/src/debug/AndroidManifest.xml with ` android:usesCleartextTraffic=“true”``.
This means that the development can make api requests only to
localhost and for some reason
This means, when I tried to do
expo start --dev-client and scan the qrcode I was received with the error message
CLEARTEXT communication to 192.168.0.106 not permitted by network security policy. So I wasn’t able to work or code in android.
What I did to “solve it” was to basically run a script after the EAS Build did the prebuild step, to overwrite the file
- I added this script into my package.json
#!/usr/bin/env bash set -eox pipefail if [[ "$EAS_BUILD_PLATFORM" == "android" && "$EAS_BUILD_PROFILE" == "development" ]]; then cp ./patches/network_security_config.xml ./android/app/src/main/res/xml/network_security_config.xml fi
<?xml version="1.0" encoding="utf-8"?> <network-security-config> <base-config cleartextTrafficPermitted="true" /> </network-security-config>
Is there a way to solve this without all this workaround? maybe with an expo plugin.