Hi Folks! :wave: I have a ksp plugin that generate...
# ksp
p
Hi Folks! 👋 I have a ksp plugin that generates some code in my android app module. However, since I’m using the generated code on the analysed code, often the compiler will remove the generated file and not compile because of
Unresolved reference
. I’ve not found anything around. Anyone hd a similar issiue before?
I guess it makes sense that it would fail since it hasn’t been generated yet. But I’m kinda struggling to see how I can fix this 🤔
y
What do you mean by using the generated code on the analyzed code?
p
So, I’m referencing the code generated by ksp on the production code. The only way I seem to make it work is if I delete the build folder.
y
Referencing code generated by ksp is completely reasonable 😀
Do you get the error consistently?
If it only happens after making changes to your source code it could be an incremental processing issue
p
I've not managed to find a reliable way to replicate the problem yet. I think it happens when y try to run a compose preview on a device
y
Try to set ksp.incremental=false temporarily and see if it still happens
p
Good shout. I'll give that a try 🙏
That seemed to work. So I guess I may be doing something wrong with my set up that doesn’t work with incremental builds 😭
y
Not sure how you’re writing the generated code, but for me this was my issue https://github.com/google/ksp/issues/1313