Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

The Flutter app reaches the network in debug mode but not in the release APK

ErrorNetwork calls fail in the installed release APK

Short answer

The default Flutter Android template allows network access only for development tools. A release build needs the android.permission.INTERNET line in the main manifest. If that line is present, check for plain http URLs, which Android 9 and newer block, and for a debug-only custom certificate setup.

  • Applies to Flutter 3.x, Android 9 to 16, release APK or AAB
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Look at the manifest that ships in the release build. If it has no INTERNET permission, the first cause applies.

    grep -n "INTERNET" android/app/src/main/AndroidManifest.xml
  2. 2Match what you see, then jump to its fix

    1. 1grep prints nothing; the debug build still works because the template allows tool traffic while developingThe main manifest has no INTERNET permissionFix
    2. 2The permission is present, but requests to an http:// address failThe API URL starts with http:// and the app targets Android 9 or newerFix
    3. 3HTTPS to your test server works with flutter run and fails with a certificate error in releaseA custom or self-signed certificate is trusted only in debug buildsFix

What does the error look like?

  • Network calls fail in the installed release APK
  • The same calls work with flutter run in debug mode

Cause 1 of 3

The main manifest has no INTERNET permission

1Check

Flutter's deployment guide says the standard template does not include this tag. It leaves development traffic open so the tools can talk to a running app, and nothing more. A release build without the tag cannot open connections.

grep -n "uses-permission" android/app/src/main/AndroidManifest.xml

2Fix

Add the permission inside the manifest tag, above the application tag, then rebuild. INTERNET is a normal permission, so it needs no runtime prompt.

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-permission android:name="android.permission.INTERNET"/>
    <application ...>

3Verify

Build the release APK again and install it over the old one.

flutter build apk --release
flutter install

Confirmed by docs.flutter.dev

Did this fix it?

Cause 2 of 3

The API URL starts with http:// and the app targets Android 9 or newer

1Check

Since Android 9 (API 28), cleartext HTTP is off by default for apps that target it.

grep -rn "http://" lib | head

2Fix

Move the API to https. If you must keep http for one host, opt in for that domain only in a network security configuration file and point the manifest at it.

<!-- android/app/src/main/res/xml/network_security_config.xml -->
<network-security-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">insecure.example.com</domain>
    </domain-config>
</network-security-config>

<!-- AndroidManifest.xml, on the application tag -->
android:networkSecurityConfig="@xml/network_security_config"

3Verify

Rebuild and call the endpoint from the installed release app.

flutter build apk --release

Confirmed by developer.android.com

Did this fix it?

Cause 3 of 3

A custom or self-signed certificate is trusted only in debug builds

1Check

A network security configuration can hold debug-overrides. Those trust anchors apply only when android:debuggable is true, and the section is ignored in a release build.

grep -rn "debug-overrides" android/app/src

2Fix

Serve the release build from a host with a certificate from a public CA. If you really need a private CA in release, declare it in a domain-config trust-anchors entry, not in debug-overrides.

<network-security-config>
    <domain-config>
        <domain includeSubdomains="true">example.com</domain>
        <trust-anchors>
            <certificates src="@raw/my_ca"/>
        </trust-anchors>
    </domain-config>
</network-security-config>

3Verify

Install the release build and open a screen that calls the server over https.

flutter install

Confirmed by developer.android.com

Did this fix it?

How do I stop it coming back?

  • Add the INTERNET permission the day the first network call is written, and keep it in the main manifest.
  • Test every release candidate by installing the release build on a device, not only by running debug.
  • Use https for every API, so the cleartext rules never come into play.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Mobile apps

Google Play says the app does not support 16 KB memory pages

check_elf_alignment.sh reports UNALIGNED for a library under lib/arm64-v8a

Google Play requires apps that target Android 15 or higher and ship native .so libraries to run on devices with 16 KB memory pages; from 1 February 2027 it will block updates that do not.

5 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.