-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KSP: Consistently failing build in first run and success on second run #4181
Comments
I'm also having this issue with an app using Circuit and its associated codegen artifacts; I'll try to create a simple project to reproduce the issue. |
I am also experiencing this problem (just commenting to raise awareness of this one) |
Thanks, if you can provide a project reproducing this that would help a lot. |
That might be tricky because to me it is happening with pretty large commercial app but I will try to reproduce this with a sample project over the weekend by isolating a module where the stack trace points to and deleting everything that's irrelevant (no promises though 😄). I also have a smaller project but that does not uses @ContributesAndroidInjector and there KSP works as expected so that's definitely needed to reproduce this bug. |
I'm also experiencing this. In addition to the author's description, despite second build being successful, it takes way longer to build and run than it was before. It feels like there is no incremental build and full clean rebuild is happening. Changing even one line of kotlin code makes it 5 minutes to run in the emulator. Before it would take me less than 10 sec to get latest code into the running app. XML code changes work fine - runs on 1st attempt and fast compilation times as before. I also tried with AGP 8.2.1 and kotlin 1.9.22 with ksp 1.9.22-1.0.16 and the problem is still there. |
Dear @bcorso, I am also facing this issue. In my case, the issue happens when I modify an Activity file that hosts fragments. I created a sample project where I can reproduce it on my end. I hope it helps the investigation. |
I tried patching the repro, and can consistently reproduce the issue with dagger 2.50. But the issue seems to be gone with dagger at head. So next release should fix this problem. |
This reverts commit 6494247. Seems like dagger/ksp is still a bit buggy, I'm getting one of these errors every other build, so lets revert this for now. google/dagger#4181 google/ksp#1196
@wanyingd1996 I just tried it out after the release of Dagger 2.51 and I am still seeing this problem unfortunately |
Hi, I was able to repro the problem at head, not sure why couldn't repro earlier. It seems to be a ksp bug where the cached generated source file wasn't discoverable by the processor. I'm working with ksp team on this issue now, will follow up once made progress. Thanks for the patience! |
fixes #4181 RELNOTES=n/a PiperOrigin-RevId: 617993785
@wanyingd1996 Thank you for the fix on this issue. I just upgraded my project to the latest dagger version and for me the issue still persist however I am getting a different exception than before saying that a generated file already exists. I saw that there is a similar issue #4161 but in my project I do not use hilt and I still get this exception. After building again the issue disappears just like before. Here is my stack trace, I would appreciate if you would take a look and let me know if I should open a new issue for this one. Thanks in advance.
|
Hi, @palpapp04, from the stack trace you provided, nothing points to dagger or hilt, it seems a bug from ksp side during incremental processing that fails to handle generated file. It is different from #4161, as that bug happens when hilt is trying to write file. So I think you may want to try bump your ksp version first, if it still fails, file a bug to the ksp issue. |
I'm on Kotlin 2.0.0, KSP 2.0.0-1.0.24 (the same is reproducible with 2.0.20-RC and 2.0.20-RC-1.0.24), and Dagger 2.52, and I'm now having the same/similar issue:
The "duplicated class" is found in 3 places:
Other details:
|
@ivtoto is the issue reproducible with KSP 1.9.24-1.0.20? |
@bcorso Yes, I just tested it, and it's the same. Using: Kotlin 1.9.24, KSP 1.9.24-1.0.20, and Dagger 2.52. |
@palpapp04 @ivtoto thanks this sounds like another bug in KSP. You can either file a bug with the KSP team (https://github.com/google/ksp/issues) or if you have a repro of the issue we can take a look and work with the KSP team to resolve it. |
There is a similar issue on ksp |
Having same setup mentioned in this closed issue. We noticed that after migrating to KSP, we always get these errors on first run (after applying changes to codebase) then success when we run again the project.
Using AGP 8.2.0 in Android Hedgehog
The text was updated successfully, but these errors were encountered: