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.
> 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
- Set
namespacein the moduleandroid {}block to the former manifest package. - Remove the
packageattribute from the manifest. - Re-run the build.
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
namespacein every Android module on AGP 8 and later. - Drop the manifest
packageattribute after migrating. - Run the AGP upgrade assistant when bumping major plugin versions.