I wager this is about versions of kotlin and the order in which to have ksp in your project.
This is how I did it:
my current kotlin version is 2.02
Step 1: add this to your to your module build.gradle.kts as a plugin
id("com.google.devtools.ksp") version "2.2.0-2.0.2"
IMPORTANT: then sync your project
Step 2: then add these to your implementation:
implementation("com.google.dagger:dagger-compiler:2.51.1")
ksp("com.google.dagger:dagger-compiler:2.51.1")
update to latest version then sync your project.
DO NOT ADD ALL THE CODE AT ONCE THEN SYNC YOUR BUILD WILL FAIL LIKE THE WAY MINE DID. Am using Android Studio Narwhal 2025.1.2
Cheers