25
26

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

lombok 1.16.2 で javax.annotaionが存在しないエラー

Posted at

内容

ほぼstackoverflowの内容のメモ

$ ./gradlew assembleDebug
...
:app:compileDebugJava
/Users/mattak/project/MyApplication/app/src/main/java/me/mattak/myapplication/MainActivity.java:13: エラー: パッケージjavax.annotationは存在しません
    @Getter(AccessLevel.PUBLIC)
    ^
/Users/mattak/project/MyApplication/app/src/main/java/me/mattak/myapplication/MainActivity.java:13: エラー: パッケージjavax.annotationは存在しません
    @Getter(AccessLevel.PUBLIC)
    ^
エラー1個
:app:compileDebugJava FAILED

上のようなエラーがでてしまう。

原因

Lombokは@javax.annotation.Generatedをすべてのノードに対して、出来る限りつけようとする。
よってAndroidでは、javax.annotation 以下のパッケージは存在しないのでエラーが出る。

対処

build.gradleと同じディレクトリにlombok.configファイルを作成する。

lombok.config
lombok.addGeneratedAnnotation = false

参考

25
26
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
25
26

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?