Skip to content
Latchkey

Android "Namespace not specified" (AGP 8) in CI

Android Gradle plugin 8 removed the package attribute from the manifest as the source of the namespace. It must be declared as namespace in the module build file, and the build fails until you set it.

What this error means

The build fails with "Namespace not specified. Specify a namespace in the module's build file." It typically appears right after upgrading to AGP 8.

Android
> Namespace not specified. Specify a namespace in the module's build file.
  See https://d.android.com/r/tools/upgrade-assistant/set-namespace for information
  about setting the namespace.

Common causes

AGP 8 dropped the manifest package as namespace source

Older projects relied on package in AndroidManifest.xml; AGP 8 ignores it for the namespace and requires an explicit namespace.

A migrated module never had namespace set

After the upgrade, a module that was not migrated has no namespace declared, so the plugin cannot determine the R class package.

How to fix it

Declare the namespace in the module

  1. Set namespace in the module android {} block to the former manifest package.
  2. Remove the package attribute from the manifest.
  3. Re-run the build.
app/build.gradle.kts
android {
  namespace = "com.example.app"
}

Use the AGP upgrade assistant

The upgrade assistant can move the package into a namespace across modules automatically.

How to prevent it

  • Set namespace in every Android module on AGP 8 and later.
  • Drop the manifest package attribute after migrating.
  • Run the AGP upgrade assistant when bumping major plugin versions.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →