Skip to content

Conversation

@copybara-service
Copy link

@copybara-service copybara-service bot commented Jan 16, 2026

Reenable AGP 9 in HiltGradlePlugin.

NEW: Upgraded AGP from 9.0.0-beta05 to 9.0.0.

Fixes #4944
Fixes #4979

*** Original change description ***

This required a number of changes:

  • Updated Gradle 8.14.3 -> 9.2.0
  • Updated shadow plugin from com.github.johnrengelman.shadow:8.1.1 to 'com.gradleup.shadow:9.2.2' (old artifact doesn't support Gradle 9).
  • Updated HiltGradlePlugin to 9.0.0-beta05:
    • Migrated BaseExtension to AndroidComponentsExtension
    • Migrated BaseVariant to Component
    • Migrated variant.javaCompileOutput.classpath to variant.compileClasspath
    • Migrated variant.javaCompileOutput.destinationDirectory to variant.artifacts.use(HiltCopyTask).toGet()
    • Migrated variant.javaCompileOutput.options.bootstrapClasspath with androidExtension.sdkComponents.bootClasspath
    • Migrated variant.javaCompileOutput.options.compilerArgumentProviders with variant.javaCompilation.annotationProcessor.argumentProviders
      project.buildDir = ... to project.layout.buildDirectory.set(...)
  • Updated HiltGradlePlugin tests to use AGP 9.0.0-beta05:
    • Migrate to builtin kotlin
      • removed 'kotlin-android'
      • replaced 'kotlin-kapt' with 'legacy-kapt'
      • Migrated javatests/artifacts/hilt-android/simple/app/build.gradle to kts and replace GradleVersion with custom AgpVersion. The GradleVersion does not work with APG versions like 9.0.0-beta02, so I had to do this with custom parsing.
    • removed android.kotlinOptions (removed in AGP 9)
    • removed android.useAndroidX=true (default in AGP 9)
    • added android.disallowKotlinSourceSets=false (workaround for KSP uses kotlin.sourceSets DSL when using AGP Built-In Kotlin ksp#2729)

RELNOTES=The next Dagger release will require AGP 9 when using the HiltGradlePlugin. This requirement is due to certain fixes only being available in AGP 9.

@Goooler
Copy link

Goooler commented Jan 17, 2026

BTW, we can edit the PR description to close #4979 and #4944.

@copybara-service copybara-service bot closed this Jan 20, 2026
@copybara-service copybara-service bot deleted the test_857185342 branch January 20, 2026 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hilt Gradle Plugin fails with AGP 9.0.0-alpha06 due to legacy variant APIs usage Hilt Gradle Plugin does not work with AGP 9.0.0-alpha04

2 participants