Hi everyone. I’ve some trouble while creating a ksp android library.
I’d like to create an android library that register a
SymbolProcessor
, but unfortunately when applying it from an android application project the processor provider couldn’t be loaded.
More details about my configuration.
I have 2 projects:
lib
(android ksp library) and
sample
(android application).
lib
apply
com.android.library
plugin and register a processor provider inside the canonical file
com.google.devtools.ksp.processing.SymbolProcessorProvider
under
resources/META-INF.services
.
I publish the
lib
in a local maven repo using gradle publish plugin configured with
android {
publishing {
singleVariant("release") {
withJavadocJar()
withSourcesJar()
}
}
}
...
publishing {
publications {
register<MavenPublication>("release") {
groupId = "foo.bar"
artifactId = "tar"
version = "1.0"
afterEvaluate {
from(components["release"])
}
...
sample
consumes it as usual
implementation("foo.bar:tar:1.0")
ksp("foo.bar:tar:1.0")
When launching
kspReleaseKotlin
or
kspDebugKotlin
task, this error arises:
e: [ksp] No providers found in processor classpath.
indeed in the jar published in my local maven repository, the file
com.google.devtools.ksp.processing.SymbolProcessorProvider
is not present.
If I transform
lib
as a jvm library, everything works right - and the
com.google.devtools.ksp.processing.SymbolProcessorProvider
is present in the published jar file.
How can I correctly ship the
com.google.devtools.ksp.processing.SymbolProcessorProvider
inside my
lib
android library? Or there is another way to define which processor provider ksp must use, and get rid of that file?