Expose metadata that helps tools and other developers understand your app's code.

This table lists all the artifacts in the androidx.annotation group.

Artifact Current Stable Release Next Release Candidate Beta Release Alpha Release
annotation 1.3.0 - - -
annotation-experimental 1.1.0 1.2.0-rc01 - -
This library was last updated on: December 1, 2021

Declaring dependencies

To add a dependency on Annotation, you must add the Google Maven repository to your project. Read Google's Maven repository for more information.

Add the dependencies for the artifacts you need in the build.gradle file for your app or module:


dependencies {
    implementation "androidx.annotation:annotation:1.3.0"
    // To use the Java-compatible @Experimental API annotation
    implementation "androidx.annotation:annotation-experimental:1.1.0"


dependencies {
    // To use the Java-compatible @Experimental API annotation

For more information about dependencies, see Add build dependencies.


Your feedback helps make Jetpack better. Let us know if you discover new issues or have ideas for improving this library. Please take a look at the existing issues in this library before you create a new one. You can add your vote to an existing issue by clicking the star button.

Create a new issue

See the Issue Tracker documentation for more information.

Version 1.3.0

Version 1.3.0

November 3, 2021

androidx.annotation:annotation:1.3.0 is released. Version 1.3.0 contains these commits.

Important changes since 1.2.0

  • @Discouraged annotation for marking APIs that cannot be reasonably deprecated but have significant negative performance impact and should not be called in normal production code
  • @Context annotation to mark generic Contexts so that developers can migrate to new APIs more easily
  • @GravityInt annotation for marking elements containing gravity values packed into integers
  • Deprecated @InspectableProperty in favor of @Attribute for androidx.resourceinspection

Version 1.3.0-rc01

October 27, 2021

androidx.annotation:annotation:1.3.0-rc01 is released. Version 1.3.0-rc01 contains these commits.

Version 1.3.0-beta01

September 29, 2021

androidx.annotation:annotation:1.3.0-beta01 is released. Version 1.3.0-beta01 contains these commits.

API Changes

  • Require explanation in 'message' for @Discouraged. (I3390f)
  • Adding @Discouraged annotation for marking elements that are discouraged. (Ib2549)
  • Make the RestrictTo annotation visible from Studio docs popup (Ie8e1a, b/183134648)

Bug Fixes

  • Add Context annotation to mark generic Contexts, so developers can migrate to new APIs more easily. (Ie581a)

Version 1.3.0-alpha01

March 24, 2021

androidx.annotation:annotation:1.3.0-alpha01 is released. Version 1.3.0-alpha01 contains these commits.

API Changes

  • Deprecated @InspectableProperty in favor of @Attribute in androidx.resourceinspection. (Ic0eff)
  • Added @GravityInt annotation for marking elements containing gravity values packed into integers. (Ifcaa4, b/180620048)

Annotation-Experimental Version 1.2.0

Version 1.2.0-rc01

December 1, 2021

androidx.annotation:annotation-experimental:1.2.0-rc01 is released. Version 1.2.0-rc01 contains these commits.

No changes from beta.

Version 1.2.0-beta01

November 17, 2021

androidx.annotation:annotation-experimental:1.2.0-beta01 is released. Version 1.2.0-beta01 contains these commits.

API Changes

APIs have been finalized for beta.

Annotation-Experimental Version 1.2.0-alpha01

June 30, 2021

androidx.annotation:annotation-experimental:1.2.0-alpha01 is released. Version 1.2.0-alpha01 contains these commits.

New Features

  • Library is now targeting Java 8 language level

Version 1.2.0

Version 1.2.0

March 24, 2021

androidx.annotation:annotation:1.2.0 is released. Version 1.2.0 contains these commits.

Major changes since 1.1.0

  • Added @ChecksSdkIntAtLeast annotation, which can be used to identify methods or fields used to gate access on SDK level and satisfy the NewApi lint check.
  • Added @DoNotInline annotation, which is paired with a Proguard rule to prevent members from being inlined during optimization.
  • A variety of annotations are now annotated with @Documented to ensure they show up in documentation for annotated members.

Version 1.2.0-rc01

February 24, 2021

androidx.annotation:annotation:1.2.0-rc01 is released. Version 1.2.0-rc01 contains these commits.

Version 1.2.0-beta01

January 13, 2021

androidx.annotation:annotation:1.2.0-beta01 is released. Version 1.2.0-beta01 contains these commits.

API Changes

  • New @DoNotInline annotation which instructs code optimizers (e.g. Proguard, R8) to not inline the annotated method. (I3dfe8, b/141326133)

Version 1.2.0-alpha01

May 14, 2020

androidx.annotation:annotation:1.2.0-alpha01 is released. Version 1.2.0-alpha01 contains these commits.

New Features

  • Added @ChecksSdkIntAtLeast annotation. This let’s androidx and users annotate methods and fields that represent an SDK_INT check. (I89a54, b/120255046)

Annotation-Experimental Version 1.1.0

Version 1.1.0

April 7, 2021

androidx.annotation:annotation-experimental:1.1.0 is released. Version 1.1.0 contains these commits.

Major changes since 1.0.0

  • Jetpack’s experimental annotations have been rewritten in Kotlin to provide support for multiple marker classes and improved handling of deprecation.
  • RequiresOptIn and OptIn annotations have been added for parity with Kotlin, and the Experimental and UsesExperimental annotations have been deprecated.

Version 1.1.0-rc02

March 24, 2021

androidx.annotation:annotation-experimental:1.1.0-rc02 is released. Version 1.1.0-rc02 contains these commits.

Bug Fixes

  • Added Proguard rules to ensure that code optimization does not warn about missing Kotlin meta-annotations.

Version 1.1.0-rc01

March 10, 2021

androidx.annotation:annotation-experimental:1.1.0-rc01 is released. Version 1.1.0-rc01 contains these commits.

No changes since prior beta release.

Version 1.1.0-beta01

January 27, 2021

androidx.annotation:annotation-experimental:1.1.0-beta01 is released. Version 1.1.0-beta01 contains these commits.

API Changes

  • The androidx variant of the Experimental annotation has been deprecated to provide parity with Kotlin. It has been replaced by an androidx variant of the RequiresOptIn annotation, and the Java-facing linter has been updated to support both the new Kotlin annotation and the new androidx variant. (I52495, b/151331381)

Version 1.1.0-alpha01

July 22, 2020

androidx.annotation:annotation-experimental:1.1.0-alpha01 is released. Version 1.1.0-alpha01 contains these commits.

New Features

  • Experimental annotation library is now written in Kotlin, but does not require the Kotlin standard library to be included as a dependency. It includes a Proguard file that allows unnecessary Kotlin metadata to be stripped from projects that only use the Java programming language.
  • @UseExperimental now supports multiple marker classes (aosp/1185577, b/145137892)

Annotation-Experimental Version 1.0.0

Annotation-Experimental Version 1.0.0

November 7, 2019

androidx.annotation:annotation-experimental:1.0.0 and androidx.annotation:annotation-experimental-lint:1.0.0 is released with no changes since 1.0.0-rc01. Version 1.0.0 contains these commits.

Major features of 1.0.0

  • Lint-based enforcement of Kotlin @Experimental semantics in Java source code
  • Java annotations that provide equivalent behavior to Kotlin’s @Experimental and @UseExperimental annotations without the need for a dependency on Kotlin

Annotation-Experimental Version 1.0.0-rc01

October 23, 2019

androidx.annotation:annotation-experimental:1.0.0-rc01 and androidx.annotation:annotation-experimental-lint:1.0.0-rc01 are released. Version 1.0.0-rc01 contains these commits.

Known issues

When using Studio 3.5 stable, warnings from the @Experimental usage lint detector are not displayed in the IDE for invalid Java usages of Kotlin @Experimental annotation. See b/140640322.

Annotation-Experimental Version 1.0.0-beta01

October 9, 2019

androidx.annotation:annotation-experimental:1.0.0-beta01 and androidx.annotation:annotation-experimental-lint:1.0.0-beta01 are released with no changes since version 1.0.0-alpha01. Version 1.0.0-beta01 contains these commits.

Annotation-Experimental Version 1.0.0-alpha01

September 18, 2019

androidx.annotation:annotation-experimental:1.0.0-alpha01 and androidx.annotation:annotation-experimental-lint:1.0.0-alpha01 are released. These are the commits included in annotation-experimental 1.0.0-alpha01 and these are the commits included in annotation-experimental-lint 1.0.0-alpha01

New features

  • The Jetpack Experimental annotation library provides a Java-compatible implementation of Kotlin’s experimental API markers. The -lint artifact provides a Lint-based implementation of experimental usage restrictions and enforces restrictions on Java usages of Kotlin’s native experimental API markers.

  • When using the annotation-experimental artifact as a dependency, the Lint rules provided by the annotation-experimental-lint artifact will be enforced automatically.

Version 1.1.0

Version 1.1.0

June 5, 2019

androidx.annotation:annotation:1.1.0 is released with no changes from 1.1.0-rc01.

Version 1.1.0-rc01

May 7, 2019

androidx.annotation:annotation:1.1.0-rc01 is released with no changes from 1.1.0-beta01. The commits included in this version can be found here.

Version 1.1.0-beta01

April 3rd, 2019

androidx.annotation:annotation:1.1.0-beta01 is released. The commits included in this version can be found here.

New features

  • New @InspectablePropertyannotation to support the new view inspection APIs added in Android 10. This annotation can be applied to getters on views or other UI elements. Code generation tools may use it to create companion objects that map property names and attribute IDs to property values without the overhead of reflection.

API changes

  • Breaking change: @ContentView has been changed to a constructor annotation and the @LayoutRes value has been removed. Classes wishing to support @ContentView annotations should add this annotation to a constructor that takes a @LayoutRes int parameter. This fixes an issue when using this annotation in library modules. (b/128352521)

Version 1.1.0-alpha02

March 13, 2019

androidx.annotation:annotation:1.1.0-alpha02 is released. The full list of commits included in this version can be found here.

New features

  • New API restriction scope: RestrictTo.Scope.LIBRARY_GROUP_PREFIX. It restricts usage to code within packages whose groups share the same library group prefix up to the last . (period). For example, because libraries and foo.baz:lib2 share the prefix foo, they can use each other's APIs that are restricted to this scope. Similarly, for and share the prefix and can share APIs restricted to that scope. Library however will not be able to use the restricted API because it only shares the prefix com. and not all the way until the last . (period).

Version 1.1.0-alpha01

January 30, 2019

androidx.annotation:annotation 1.1.0-alpha01 is released.

New features

  • Added a @ContentView annotation that allows you to indicate which layout XML file should be inflated. This is supported in ComponentActivity in its 1.0.0-alpha04 and Fragment in its 1.1.0-alpha04 release as an alternative to using setContentView() or overriding onCreateView(), respectively. (aosp/837619)

Version 1.0.2

Version 1.0.2

February 25, 2019

androidx.annotation:annotation 1.0.2 is released.

Bug fixes

  • Correct the R8/ProGuard rules which are embedded in the jar. These were incorrectly referencing the old types instead of androidx.annotation. Note: This would have only had an impact on your builds if you were not using getDefaultProguardFile as those default rules also included correct rules for both packages. (aosp/891685)
  • Add a R8/ProGuard rule which explicitly keeps the @Keep annotation itself. This ensures that ProGuard does not remove the annotation from types prior to actually honoring its semantics. Note: This would have only had an impact on your builds if you were not using getDefaultProguardFile as those default rules also included correct rules for both packages. (aosp/903818)