https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
m

Maurice Jouvet

01/22/2020, 3:56 PM
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

Kris Wong

01/22/2020, 3:58 PM
m

Maurice Jouvet

01/22/2020, 4:03 PM
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

Kris Wong

01/22/2020, 4:20 PM
what if you try it within
android.dependencies
?
m

Maurice Jouvet

01/22/2020, 4:20 PM
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

Kris Wong

01/22/2020, 4:25 PM
🙌
m

Maurice Jouvet

01/22/2020, 4:26 PM
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

Kris Wong

01/22/2020, 4:41 PM
sounds like progress
m

Maurice Jouvet

01/22/2020, 8:50 PM
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

Kris Wong

01/22/2020, 8:53 PM
that's an odd one
m

Maurice Jouvet

01/22/2020, 9:08 PM
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
550 Views