Skip to content

Hilt 2.59: ComponentTreeDeps annotation missing from runtime artifacts - compilation fails with AGP 9.0 #5099

@paragbaxi

Description

@paragbaxi

After upgrading to Hilt 2.59 with AGP 9.0.0, the build fails because the Hilt Gradle plugin generates code referencing dagger.hilt.internal.componenttreedeps.ComponentTreeDeps, but this class does not exist in any Hilt 2.59 runtime artifact.

Environment

  • Hilt version: 2.59
  • AGP version: 9.0.0
  • Gradle version: 9.3.0
  • Kotlin version: 2.2.10
  • KSP version: 2.2.10-2.0.2
  • OS: macOS (also reproducible on Linux CI)

Steps to Reproduce

  1. Configure project with AGP 9.0.0 and Hilt 2.59:
    // build.gradle.kts
    plugins {
    id("com.google.dagger.hilt.android") version "2.59"
    }
  2. Run a clean build:
    ./gradlew clean assembleDebug

Expected Behavior

Build succeeds - generated Hilt code compiles against Hilt runtime.

Actual Behavior

Compilation fails with:

error: package dagger.hilt.internal.componenttreedeps does not exist
import dagger.hilt.internal.componenttreedeps.ComponentTreeDeps;
^

error: cannot find symbol
@ComponentTreeDeps(
^
symbol: class ComponentTreeDeps

Investigation

I verified the class is missing from all Hilt 2.59 artifacts:

Search all Dagger 2.59 JARs in Gradle cache

find ~/.gradle/caches -name "*.jar" -path "dagger" -path "2.59" -exec jar tf {} ; | grep -i componenttree

No results

Confirm the annotation doesn't exist

find ~/.gradle/caches -name "*.jar" -path "hilt" -path "2.59" -exec jar tf {} ; | grep componenttreedeps

No results

The Hilt Gradle plugin generates code that imports dagger.hilt.internal.componenttreedeps.ComponentTreeDeps, but this package/class does not exist in:

  • hilt-android-2.59.jar
  • hilt-core-2.59.jar
  • hilt-android-compiler-2.59.jar
  • Any other Dagger 2.59 artifact

Workaround

Downgrade to Hilt 2.58. Despite not officially supporting AGP 9.0, it builds and runs correctly:

// gradle/libs.versions.toml
googleDaggerHilt = "2.58" # Works with AGP 9.0

Root Cause Hypothesis

It appears the 2.59 release included the Gradle plugin changes for AGP 9.0 support (which generate ComponentTreeDeps references) but the corresponding runtime annotation class was not included in the published artifacts.

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