在 Android Studio 中使用@Contract

Using ­@Contract with Android Studio

我正在尝试使用 IntelliJ 的 @Contract 注释,但在 Android Studio 中。我无法导入它,它不存在。在 website explaining it 上,据说可以使用“项目结构”对话框将 <installation folder>/lib/annotations.jar 添加到项目的类路径中,但我没有找到该怎么做。

是否可以在 Android Studio 上使用 @Contract 注释?

注释 jar 在 maven repository 中可用。只需在 build.gradle 文件中添加 compile group: 'org.jetbrains', name: 'annotations', version: '13.0'