| 1 | const { withAndroidManifest } = require("expo/config-plugins"); |
| 2 | |
| 3 | module.exports = function withAndroidCleartextTraffic(config) { |
| 4 | return withAndroidManifest(config, (nextConfig) => { |
| 5 | const application = nextConfig.modResults.manifest.application?.[0]; |
| 6 | |
| 7 | if (application == null) { |
| 8 | throw new Error( |
| 9 | "AndroidManifest.xml is missing the application element required for cleartext traffic configuration.", |
| 10 | ); |
| 11 | } |
| 12 | |
| 13 | application.$ ??= {}; |
| 14 | application.$["android:usesCleartextTraffic"] = "true"; |
| 15 | |
| 16 | return nextConfig; |
| 17 | }); |
| 18 | }; |