External annotations in Android Studio with Gradle


#1

I'm using KAnnotator with Android Studio to generate external annotations for some external Java libraries. The external annotations work at first, but after closing and re-opening the project, or updating any of the Gradle build files and letting Android Studio resync the project, the external annotations are no longer configured in the IDE.

I’ve tried adding kotlinOptions.annotations = file(“path/to/annotations”) to the gradle build file. This allows builds using Gradle on the command line to succeed, but Android Studio still flags calls to these libraries that aren’t doing null checks as errors. I’ve also tried creating a jar file with the external annotations and adding this as a compile dependency to the project, but this doesn’t seem have any effect on the IDE either.

Is there any way to have Android Studio configure external annotations on the project when it imports or refreshes from the Gradle build file, or is it currently a requirement to re-run KAnnotator whenever the project refreshes?

I’m running Android Studio 0.57, Kotlin plugin 0.7.270.1, KAnnotator 0.2.1205, and Gradle 1.10. The gradle plugin version in the build file is 0.7.271. This also occurs with the same project on IntelliJ IDEA 13.1.2.


#2

I have the same problem


#3

Could you report this to the issue tracker? Thanks


#4

I've reported the issue - http://youtrack.jetbrains.com/issue/KT-5023