Skip to content

AGP 9 compatibility: affected-paths Android model extraction fails before affected modules are computed #48

Description

@mr-thierry

affected-paths currently breaks on Android projects using AGP 9.x because the Android project extraction path is tied to legacy variant APIs.

Problem

When running affected-path analysis on an AGP 9 project, the tooling step fails before returning affected modules.

Typical failure signatures include:

org.gradle.tooling.BuildActionFailureException
Caused by: java.lang.IllegalArgumentException: Required value was null
at com.squareup.tooling.support.android.AndroidProjectExtractorKt.extractAppModuleProject(...)

and (in late-evaluation contexts/tests):

It is too late to add actions as the callbacks already executed.
Did you try to call onVariants from the old variant API 'applicationVariants'...

Impact

  • Affected-path computation crashes instead of producing module paths.
  • CI workflows that rely on affected-paths for selective builds/tests fail or must fall back to full test scope.

Reproduction (high level)

  1. Use an Android multi-module project on AGP 9.x.
  2. Apply the affected-path tooling/model extraction path.
  3. Run affected-path analysis (CLI or core analyzer path).
  4. Observe crash during Android model extraction.

Root cause (high level)

The extractor logic depends on legacy AGP variant/model behavior that changed in AGP 9.
The runtime Android extension/variant wiring no longer matches assumptions from the old AppExtension/BaseVariant style extraction path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions