We moved some classes between gradle modules. Looks like it worked on a clean build otherwise CI wouldn't have been able to merge it.
But locally, some of us have problems like:
/build/generated/source/kaptKotlin/foo/bar/BazJsonAdapter.kt: (42, 52): Unresolved reference: Baz
The JsonAdapter is generated but in the wrong place, Baz is in another module now.
Some team mates say a full monkey dance (clean, cleanBuildCache, delete build folders, invalidate caches and restart and sync) helped them when they did it for multiple times.
To me it stinks a bit, sounds like an unknown problem with unknown solution, I thought it might be worth reporting.
gradle 5.6.1, AS 3.5, moshi 1.8.0
Please file issues with Kotlin, as we don't control how the Gradle plugin manages stale files
Upgrating gradle from 5.6.1 to 5.6.2 solved it on my machine and 2 others.
Upgrating gradle from 5.6.1 to 5.6.2 solved it on my machine and 2 others.
Most likely not related to Gradle, but to Kapt plugin as Zac mentioned.
Each Gradle version stores its cache in a different folder and that's probably why you don't see this issue. Try moving the file again and you'll get this error.
It looks like this was fixed in Kapt via https://github.com/JetBrains/kotlin/commit/60fa632d0261eb278bec49e5deb6779788bcd807#diff-e88ca9ad046147fe162f04d09f2823ce
I do not think it is fixed, we all in our team periodically have this issue, especially when switching between branches where different count of Moshi models.
It is really annoying as we have to remove the whole folder ~/.gradle/caches and wait then for a while once everything is loaded again.
Neither clean or cleanBuildCache works for sure just sometimes and it seems more like random luck rather than a solution.
Most helpful comment
It looks like this was fixed in Kapt via https://github.com/JetBrains/kotlin/commit/60fa632d0261eb278bec49e5deb6779788bcd807#diff-e88ca9ad046147fe162f04d09f2823ce