https://kotlinlang.org logo
Title
d

Dutch

01/30/2022, 1:33 PM
In my Android project I'm resolving a specific, with KSP generated, class during runtime using the
Class.forName(String)
method. For some reason, when running instrumented tests I get a
ClassNotFoundException
. Even when adding the processor with
kspTest
and
kspAndroidTest
...
t

Tower Guidev2

01/30/2022, 1:39 PM
Hi, how do you get ksp to work and generate code in your android project? i cannot achieve code generation 😞 would you mind sharing you gradle configuration with me? im using gradle groovy ... also .. sorry for not being to help with your issue🤦‍♂️
d

Dutch

01/30/2022, 1:43 PM
Sure and np. Basically I'm calling my KSP project with:
ksp(project(path = ":YOURPROCESSOR", configuration = "default"))
t

Tower Guidev2

01/30/2022, 1:45 PM
cheers, im trying to use a third party plugin caled
ksp "io.arrow-kt:arrow-optics-ksp-plugin:1.0.6-alpha.1"
i havent written a ksp processor myself i just dont know why i cannot generate any code
do you know how i need to configure a third party plugin to get code generation to work correctly? this third party have a website that explains how to configure both gradle and gradle kts files shown here which looks very simple, however it does not work 🥲
d

Dutch

01/30/2022, 1:50 PM
Will answer under your post in the channel. In the hope that somebody can help me with my problem
👍 1
Issue has been resolved. Error mostly sits in front of the screen... Now I only have the issue left that ksp with android does not work with incremental builds. So I always have to delete the build dir, prior debugging or testing
😁 1
g

Grégory Lureau

01/30/2022, 7:04 PM
Did the ksp processor you're using generates the classes you're searching in build/generated? (If yes, and your code is not referring to these classes, then it could be stripped/not loaded for some reasons.)
👍 1
d

Dutch

01/30/2022, 7:32 PM
Ah, I wanted to answer you with a reference to an issue I found on github. While searching that one, I found another issue which pointed me, at my error: https://github.com/google/ksp/issues/654#issuecomment-947192041 So, that one is also solved. Thank you 😀
👍 1