PC パソコン

How to Fix “processDebugUnitTestManifest: Referenced navigation file not found” in Android Studio

After upgrading from AGP 9.0.1 to 9.1.0, projects that use Navigation Component’s <nav-graph> element in AndroidManifest.xml can fail in processDebugUnitTestManifest with “Referenced navigation file not found.” Because this regression affects the unit-test manifest path, verify the AGP version before assuming that an existing navigation resource was deleted.

Representative log

> Task :app:processDebugUnitTestManifest FAILED

Manifest merger failed:
Referenced navigation file not found
navigationXmlId = nav_graph

The resource name varies by project. A key diagnostic detail is that the normal Debug APK may process successfully while the unit-test manifest task fails.

Cause

The <nav-graph android:value="@navigation/nav_graph" /> manifest element lets the Navigation tooling expand deep-link information from a navigation graph into the manifest. AGP 9.1.0 introduced a regression in the unit-test manifest path that could fail to resolve this resource and report it as missing even when the XML file exists.

Google’s official fixed-issues page identifies Issue #496616822 as a regression from AGP 9.0.1 to 9.1.0. The fix is listed with AGP 9.2.0-alpha07, released alongside Android Studio Panda 4 Canary 3.

Affected conditions and versions

  • The project uses Android Gradle Plugin 9.1.0.
  • AndroidManifest.xml contains a <nav-graph> reference.
  • A task such as testDebugUnitTest triggers processDebugUnitTestManifest.
  • The same project succeeded on AGP 9.0.1 and began failing after the 9.1.0 upgrade.

The first officially confirmed fixed build is AGP 9.2.0-alpha07. For a stable toolchain, use AGP 9.2.0 or later.

Recommended resolution

  1. Upgrade AGP to 9.2.0 or later. If the project uses a version catalog, edit gradle/libs.versions.toml.
[versions]
agp = "9.2.0"

[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }

If plugin versions are declared in the root plugins block, update them there:

plugins {
    id("com.android.application") version "9.2.0" apply false
    id("com.android.library") version "9.2.0" apply false
}
  1. Check the Gradle Wrapper and JDK against the AGP 9.2 compatibility table.
  2. Run Gradle Sync in Android Studio.
  3. Run the previously failing unit-test manifest task again.
./gradlew :app:processDebugUnitTestManifest --stacktrace
./gradlew :app:testDebugUnitTest

Alternative when an upgrade is blocked

If another plugin prevents an immediate move to AGP 9.2, temporarily return to AGP 9.0.1. Google explicitly records the problem as a 9.0.1-to-9.1.0 regression, so this also provides a useful diagnostic comparison.

[versions]
agp = "9.0.1"

Disabling unit tests or removing <nav-graph> changes test coverage or deep-link manifest generation and is not recommended as a general fix. If either is unavoidable, keep it temporary and test the consequences.

How to verify the fix

  1. Record the environment with ./gradlew --version.
  2. Confirm that AGP is 9.2.0 or later, or temporarily 9.0.1.
  3. Verify that :app:processDebugUnitTestManifest succeeds.
  4. Run the full unit-test suite.
  5. Inspect the generated manifest and test deep links on a device or emulator.

Cautions

A misspelled resource, a graph stored in the wrong module, or an incorrect source-set path can produce similar text. If the project also fails on AGP 9.0.1, or if processDebugMainManifest fails too, do not assume this regression. Check src/main/res/navigation and the manifest reference directly.

Updating AGP without aligning Gradle, the JDK, and Kotlin plugins can introduce a separate compatibility failure. Keep the related toolchain versions within Google’s documented compatibility ranges.

Summary

When only processDebugUnitTestManifest reports “Referenced navigation file not found” on AGP 9.1, the likely cause is the documented regression rather than a missing Navigation XML file. Upgrade to fixed AGP 9.2.0 or later. If that is temporarily impossible, return to 9.0.1 and verify the main manifest, unit tests, and deep-link behavior.

Official references