Cleartext HTTP traffic not permitted Flutter / Dart Origin: On your device OSI layer 7 · Application Last updated 4 Nov 2026

Flutter (Android): java.io.IOException: Cleartext HTTP traffic to api.example.com not permitted

Android 9+ blocks plain http:// requests by default; the app must use HTTPS or explicitly allow cleartext for that host.

Exact message you may see Cleartext HTTP traffic to not permittedjava.io.IOException: Cleartext HTTP traffic not permittedCLEARTEXT communication to not permitted by network security policy
Seen on: Flutter Android

Meaning

Network security config prohibits cleartext since API 28. Prefer switching the API to HTTPS. For development servers, add a network_security_config.xml allowing cleartext for specific domains, or android:usesCleartextTraffic="true" for debug only.

Common causes

  • Calling an http:// URL on Android 9+
  • Local dev server over HTTP
  • Redirect from HTTPS to HTTP
  • WebView loading http content
  • Release build using debug-only manifest

⚡ Quick fix

  1. Use HTTPS endpoints
  2. For dev add android:usesCleartextTraffic="true" in a debug manifest or a domain-specific config
  3. Never allow cleartext globally in release

Detailed fix by platform

Android

  1. android/app/src/debug/AndroidManifest.xml: <application android:usesCleartextTraffic="true" tools:replace="android:usesCleartextTraffic"/>

How to diagnose

  1. URL — http or https?
  2. Build — Debug only?
  3. Host — Specific domain config?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: On your device. Errors that are often confused with or caused by this one (click to open):

A Timer is still pending even after the widget tree was disposed — Flutter test: A Timer is still pending even after the widget tree was disposed (Flutter / Dart)A Timer is still pend…Android license status unknown / licenses not accepted — flutter doctor: Android license status unknown. Run `flutter doctor --android-licenses` to accept the SDK licenses (Flutter / Dart)Android license statu…App Transport Security has blocked a cleartext HTTP load — iOS: The resource could not be loaded because the App Transport Security policy requires the use of a secure connection (NSURLErrorDomain -1022) (Flutter / Dart)App Transport Securit…BoxConstraints forces an infinite width — Flutter: BoxConstraints forces an infinite width. These invalid constraints were provided to RenderStack's layout() function (TextField in a Row) (Flutter / Dart)BoxConstraints forces…cmdline-tools component is missing — flutter doctor: Android SDK is missing command-line tools; download from https://goo.gl/XxQghQ — cmdline-tools component is missing (Flutter / Dart)cmdline-tools compone…Dependency requires compileSdk 34 or later — Android Gradle: Execution failed for task ':app:checkDebugAarMetadata'. Dependency requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs (Flutter / Dart)Dependency requires c…Error: Could not find the correct Provider — Flutter: Error: Could not find the correct Provider<CartModel> above this Consumer<CartModel> Widget (Flutter / Dart)Error: Could not find…Expected: exactly one matching candidate, Actual: found 0 widgets — Flutter test: Expected: exactly one matching candidate Actual: _TextFinder:<Found 0 widgets with text "Hello"> (Flutter / Dart)Expected: exactly one…Cleartext…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.