dependencies { kapt "org.jetbrains.kotlin:kotlin-annotation-processing:$kotlin_version" } @Retention(AnnotationRetention.SOURCE) annotation class MyAnnotation(val value: String) @AutoService(Processor::class) @SupportedSourceVersion(SourceVersion.RELEASE_8) @SupportedAnnotationTypes("com.example.MyAnnotation") class MyAnnotationProcessor : AbstractProcessor() { override fun process(annotations: MutableSet<out TypeElement>?, roundEnv: RoundEnvironment?): Boolean { return true } } kapt { arguments { arg("kapt.kotlin.generated", "${project.buildDir}/kapt3") } }


上一篇:
下一篇:
切换中文