Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

Keep

@Target([AnnotationTarget.CLASS, AnnotationTarget.FILE, AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.FIELD]) class Keep
androidx.annotation.Keep

Denotes that the annotated element should not be removed when the code is minified at build time. This is typically used on methods and classes that are accessed only via reflection so a compiler may think that the code is unused.

Example:

<code>
   @Keep
   public void foo() {
       ...
   }
  </code>

Summary

Public constructors

Denotes that the annotated element should not be removed when the code is minified at build time.

Public constructors

<init>

Keep()

Denotes that the annotated element should not be removed when the code is minified at build time. This is typically used on methods and classes that are accessed only via reflection so a compiler may think that the code is unused.

Example:

<code>
   @Keep
   public void foo() {
       ...
   }
  </code>