Maaz Zindani

Loading the index…

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

Gradle says the Android namespace is not specified

ErrorNamespace not specified. Specify a namespace in the module's build file.

Short answer

Android Gradle Plugin 8 reads the package name for R and BuildConfig from the namespace property in the module's build file, not from the manifest. Read the error to see which module lacks it, then add namespace to that module's android block. If the module is a pub plugin, try a newer version of it first.

  • Applies to Android Gradle Plugin 8.x, Gradle 8, Flutter 3.x
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Read the first lines of the failure. They name the Gradle project (for example :app or :some_plugin) that has no namespace. That name decides which cause below applies.

    cd android && ./gradlew :app:assembleDebug --stacktrace
  2. 2Match what you see, then jump to its fix

    1. 1The failing project is :app or a module you wroteYour own app or library module has no namespaceFix
    2. 2The failing project is a plugin, such as :some_pluginA package from pub.dev is an older release without a namespaceFix
    3. 3The AGP Upgrade Assistant blocks the upgrade, or tests fail after setting namespaceThe test namespace equals the main namespaceFix

What does the error look like?

  • Namespace not specified. Specify a namespace in the module's build file.
  • A failure occurred while evaluating the project ':some_plugin'

Cause 1 of 3

Your own app or library module has no namespace

1Check

AGP 8.0 made the namespace required in the module-level build script. Older projects kept the package only in the manifest. Open the module's build file and look for namespace in the android block.

grep -n "namespace" android/app/build.gradle*
grep -n "package=" android/app/src/main/AndroidManifest.xml

2Fix

Add namespace to the android block. Use the value that was in the manifest package attribute, which should match the base package where your Kotlin or Java code lives. Keep applicationId set explicitly, because without it the application ID follows the namespace.

android {
    namespace "com.example.myapp"
    defaultConfig {
        applicationId "com.example.myapp"
    }
}

3Verify

Rebuild the module.

flutter build apk --debug

Confirmed by developer.android.com

Did this fix it?

Cause 2 of 3

A package from pub.dev is an older release without a namespace

1Check

Plugins are Gradle modules too, so each needs a namespace under AGP 8. See whether a newer release of the plugin exists.

flutter pub outdated

2Fix

Upgrade the plugin to its newest release. Plugin code is not in your project, so that is the first fix to try. If no release exists, the plugin needs a change from its authors.

flutter pub upgrade some_plugin

3Verify

Build again and confirm the failure no longer names the plugin.

flutter build apk --debug

Confirmed by developer.android.com

Did this fix it?

Cause 3 of 3

The test namespace equals the main namespace

1Check

Older AGP versions inferred the test namespace from the main one. Check whether testNamespace was set to the same value as namespace.

grep -rn "testNamespace" android/

2Fix

Give the test source sets their own name. By default it is the main namespace with .test added. Never set both to the same value, or the namespaces collide.

android {
    namespace "com.example.myapp"
    testNamespace "com.example.myapp.test"
}

3Verify

Run the unit tests for the module.

cd android && ./gradlew :app:testDebugUnitTest

Confirmed by developer.android.com

Did this fix it?

How do I stop it coming back?

  • Set namespace and applicationId explicitly in every module you own.
  • Run flutter pub outdated before an AGP upgrade, so plugins that are behind show up first.
  • Use the AGP Upgrade Assistant in Android Studio when you move to a new AGP major version.

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.