How can I add annotationProcessor on my build.grad...
# multiplatform
m
How can I add annotationProcessor on my build.gradle.kts (DSL)? (I’m on Android part here) I need that:
Copy code
kapt("androidx.lifecycle:lifecycle-compiler:$lifecycleVersion")
But with my configuration it’s not working, can’t find the solution.. It says, required KaptOption.. Here is what I have:
Copy code
sourceSets {
    val androidMain by getting {
        kotlin.srcDir("src/main/kotlin")
        dependencies {
            kapt("androidx.lifecycle:lifecycle-compiler:$lifecycleVersion")
k
m
Hum, not working for me, the same thing.. Type mismatch: inferred type is String but Action<KaptExtension> was expected
I did exactly the same configuration:
Copy code
dependencies {
    kapt("androidx.lifecycle:lifecycle-compiler:$lifecycleVersion")
}
I am using the latest version of gradle. 6.1.
I found this: https://github.com/gradle/kotlin-dsl-samples/issues/1372 But not working as well..
k
what if you try it within
android.dependencies
?
m
How can I do that?
Ok I found.
Ah! It passed in android!!! I am building right now, hope it’s going to work. Thank you very much!!!!
k
🙌
m
Damn still the same issue: > Annotation processors must be explicitly declared now. The following dependencies on the compile classpath are found to contain annotation processor.
I’ll try something else, thank you very much anyway.
I’m stuck..
k
sounds like progress
m
I have some progress now, I have this error: Project with path ‘androidx.lifecyclelifecycle compiler2.2.0-rc03’ could not be found in project ‘:android’.
k
that's an odd one
m
Ok by changing kapt(project()) by kapt(compileOnly()) it passed. But I have now the original issue: Annotation processors must be explicitly declared now. The following dependencies on the compile classpath are found to
926 Views