The Flutter app reaches the network in debug mode but not in the release APK
Network calls fail in the installed release APKShort 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.
Fix it fast
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.xml2Match what you see, then jump to its fix
- 1
grep prints nothing; the debug build still works because the template allows tool traffic while developingThe main manifest has no INTERNET permissionFix - 2
The permission is present, but requests to an http:// address failThe API URL starts with http:// and the app targets Android 9 or newerFix - 3
HTTPS 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
- 1
What does the error look like?
Network calls fail in the installed release APKThe 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.xml2Fix
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 installConfirmed by docs.flutter.dev
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 | head2Fix
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 --releaseConfirmed by developer.android.com
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/src2Fix
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 installConfirmed by developer.android.com
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:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- Dispatch ProA real-time logistics platform: Flutter apps, Spring Boot services and a Kafka event pipeline on AWS.
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 fixMobile apps
Gradle cannot find com.google.firebase:firebase-analytics-ktx
Required by: project :app
Firebase moved the Kotlin extensions into the main modules and stopped releasing the -ktx modules in July 2025.
2 causes, each with a fixMobile apps
Gradle cannot create LibraryVariantBuilderImpl in a Flutter Android build
Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl
This error appears when the Android Gradle plugin (AGP) cannot run in the Gradle or IDE you use.
3 causes, each with a fixMobile apps
Flutter release build cannot open the keystore: HmacPBESHA256 not available
Algorithm HmacPBESHA256 not available
The keystore is a PKCS12 file protected by a newer algorithm than the Java that is reading it understands.
3 causes, each with a fixMobile apps
Android install error: the package conflicts with an existing package of the same name
The package conflicts with an existing package by the same name
Android allows only one app per application ID, and an update must be signed with the same certificate as the installed version.
3 causes, each with a fixMobile apps
Android resource linking fails with resource android:attr/lStar not found
error: failed linking references.
The lStar attribute exists only from Android API 31.
2 causes, each with a fix