Annotation
  
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 Stable Release Release Candidate Beta Release Alpha Release
annotation 1.9.1 - - -
annotation-experimental 1.4.1 - - 1.5.0-alpha01
This library was last updated on: October 30, 2024

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:

Groovy

dependencies {
    implementation "androidx.annotation:annotation:1.9.1"
    // To use the Java-compatible @androidx.annotation.OptIn API annotation
    implementation "androidx.annotation:annotation-experimental:1.4.1"
}

Kotlin

dependencies {
    implementation("androidx.annotation:annotation:1.9.1")
    // To use the Java-compatible @androidx.annotation.OptIn API annotation
    implementation("androidx.annotation:annotation-experimental:1.4.1")
}

For more information about dependencies, see Add build dependencies.

Feedback

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.9

Version 1.9.1

October 30, 2024

androidx.annotation:annotation-*:1.9.1 is released. Version 1.9.1 contains these commits.

Bug Fixes

  • Added JS target platform. (I2310b)
  • Kotlin version update to 1.9 (I1a14c)

Version 1.9.0

October 16, 2024

androidx.annotation:annotation-*:1.9.0 is released. Version 1.9.0 contains these commits.

Important changes since 1.8.0

  • Added support for the following Kotlin Multiplatform targets: watchosDeviceArm64, mingwX64, linuxArm64.

Version 1.9.0-rc01

October 2, 2024

androidx.annotation:annotation-*:1.9.0-rc01 is released. Version 1.9.0-rc01 contains no changes since the previous beta.

Version 1.9.0-beta01

September 18, 2024

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

API Changes

Version 1.9.0-alpha03

September 4, 2024

androidx.annotation:annotation-*:1.9.0-alpha03 is released. Version 1.9.0-alpha03 contains no changes since the previous alpha.

Version 1.9.0-alpha02

August 21, 2024

androidx.annotation:annotation-*:1.9.0-alpha02 is released. Version 1.9.0-alpha02 contains these commits.

New Features

Version 1.9.0-alpha01

June 26, 2024

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

External Contribution

  • Adds support for linuxArm64 multiplatform target (thanks to Jake Wharton!)

Version 1.8

Version 1.8.2

August 7, 2024

androidx.annotation:annotation-*:1.8.2 is released. Version 1.8.2 contains these commits.

Bug Fixes

Version 1.8.1

July 24, 2024

androidx.annotation:annotation-*:1.8.1 is released. Version 1.8.1 contains these commits.

Bug Fixes

  • Includes additional Kotlin Multiplatform targets: watchos, tvos.

Version 1.8.0

May 14, 2024

androidx.annotation:annotation-*:1.8.0 is released. Version 1.8.0 contains these commits.

Important changes since 1.7.0

  • Added @ReplaceWith annotation to express replacements for deprecated APIs
  • The @MainThread annotation has been moved to the common source set.

Version 1.8.0-rc01

May 1, 2024

androidx.annotation:annotation-*:1.8.0-rc01 is released. Version 1.8.0-rc01 contains no changes since the prior beta release.

Version 1.8.0-beta02

April 17, 2024

androidx.annotation:annotation-*:1.8.0-beta02 is released. Version 1.8.0-beta02 contains no changes since the prior release.

Version 1.8.0-beta01

April 3, 2024

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

New Features

  • ReplaceWith annotation is now API-stable, but the associated lint check with auto-fix has not shipped yet

Version 1.8.0-alpha02

March 20, 2024

androidx.annotation:annotation-*:1.8.0-alpha02 is released with no notable changes. Version 1.8.0-alpha02 contains these commits.

Version 1.8.0-alpha01

February 21, 2024

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

API Changes

  • Added @ReplaceWith annotation to express replacements for deprecated APIs. (I38db3, b/322373864)

External Contributions

  • Thanks Ivan Matkov for moving the @MainThread annotation to the common source set. (6f228c)

Version 1.7

Version 1.7.1

December 13, 2023

androidx.annotation:annotation-*:1.7.1 is released. Version 1.7.1 contains these commits.

Bug Fixes

  • Use compile scope when inserting default platform dependency. (I4958f)

Version 1.7.0

September 6, 2023

androidx.annotation:annotation-*:1.7.0 is released. Version 1.7.0 contains these commits.

Important changes since 1.6.0

  • Includes Kotlin Multiplatform artifacts targeting iOS, Linux, and MacOS platforms.
  • You can now use Annotations in KMM projects. Note that non-Android targets of Annotations are still experimental but we decided to merge versions to make it easier for developers to try them. Specifically, some annotations might move between common and platform specific code during the alpha development as we finalize the boundaries.

Version 1.7.0-rc01

August 23, 2023

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

This release does not contain any changes from the prior beta.

Version 1.7.0-beta01

August 9, 2023

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

New Features

  • Stabilized APIs for release

Version 1.7.0-alpha03

July 26, 2023

androidx.annotation:annotation-*:1.7.0-alpha03 is released. Version 1.7.0-alpha03 contains these commits.

Bug Fixes

  • Maven POM publication now includes default JVM-targeted multiplatform artifact as dependency

Version 1.7.0-alpha02

March 24, 2023

androidx.annotation:annotation-*:1.7.0-alpha02 is released.

Bug Fixes

  • Removed dependency constraints from Maven artifacts to workaround a build problem in Kotlin Native Targets (b/274786186, KT-57531).

Version 1.7.0-alpha01

March 22, 2023

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

New Features

  • Includes Kotlin Multiplatform artifacts targeting iOS, Linux, and MacOS platforms.
  • You can now use Annotations in KMM projects. Note that non-Android targets of Annotations are still experimental but we decided to merge versions to make it easier for developers to try them. Specifically, some annotations might move between common and platform specific code during the alpha development as we finalize the boundaries.

Version 1.6

Version 1.6.0

February 22, 2023

androidx.annotation:annotation:1.6.0 and androidx.annotation:annotation-jvm:1.6.0 are released. Version 1.6.0 contains these commits.

Important changes since 1.5.0

  • Adds a @RequiresExtension annotation to express that an API requires a particular version of a particular extension SDK (I5e4fe)
  • Converted annotation library to build using the Kotlin Multiplatform toolchain (I3be8d)

Version 1.6.0-rc01

February 8, 2023

androidx.annotation:annotation:1.6.0-rc01 and androidx.annotation:annotation-jvm:1.6.0-rc01 are released. Version 1.6.0-rc01 contains these commits.

  • Annotation has been stabilized for release candidate 1.6.0-rc01.

Version 1.6.0-beta01

January 25, 2023

androidx.annotation:annotation:1.6.0-beta01 and androidx.annotation:annotation-jvm:1.6.0-beta01 are released with no changes from 1.6.0-alpha01.

Version 1.6.0-alpha01

January 11, 2023

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

Version 1.6.0-dev01

February 8, 2023

androidx.annotation:annotation-*:1.6.0-dev01 is released. Version 1.6.0-dev01 contains these commits.

  • Annotation has enabled Kotlin multi-platform for developer preview 1.6.0-dev01.

New Features

  • Adds a @RequiresExtension annotation to express that an API requires a particular version of a particular extension SDK. (I5e4fe)
  • Converted annotation library to build using the Kotlin Multiplatform toolchain (I3be8d)

Version 1.5.0

Version 1.5.0

September 21, 2022

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

Important changes since 1.4.0

  • Annotation library has been fully migrated to Kotlin sources, resulting in support for Kotlin-specific target use sites and other Kotlin-compatible annotation features.

Version 1.5.0-rc01

September 7, 2022

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

  • No changes from previous 1.5.0 beta release.

Version 1.5.0-beta01

August 24, 2022

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

  • No changes from previous release. API surface has been frozen for beta.

Version 1.5.0-alpha02

August 10, 2022

androidx.annotation:annotation:1.5.0-alpha02 is released. Version 1.5.0-alpha02 contains these commits.

  • No changes since the previous alpha release.

Version 1.5.0-alpha01

July 27, 2022

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

New Features

  • Annotation library has been fully migrated to Kotlin sources, resulting in support for Kotlin-specific target use sites and other Kotlin-compatible annotation features.

Version 1.4.0

Version 1.4.0

June 15, 2022

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

Important changes since 1.3.0

  • @RestrictTo has been migrated to Kotlin sources and now supports @file usage site. As a result, the Annotation library now depends on the Kotlin standard library.
  • @ReturnThis (b/140249763): Ensures that overriding methods of this method must return the same instance (intended for builders etc)
  • @OpenForTesting (b/141539024): Kotlin classes and methods marked "open" can be annotated with this annotation, and lint will make sure that this class is only subclassed (and methods only overridden) from unit tests
  • @DeprecatedSinceApi (b/37116481): Indicates that the annotated method (or class or field) is part of a backport library for a platform API, which is no longer needed as of the given API level.
  • @EmptySuper: Indicates that this method is defined to be empty, so when overriding you do not need to call it (and in fact you shouldn't; for example, it can contain backwards compatibility checking.)

Version 1.4.0-rc01

June 1, 2022

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

  • API surface and functionality have been finalized for release.

Version 1.4.0-beta01

May 18, 2022

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

  • No changes since the last alpha. API surface has been locked down for Beta release.

Version 1.4.0-alpha02

February 9, 2022

androidx.annotation:annotation:1.4.0-alpha02 is released. Version 1.4.0-alpha02 contains these commits.

New Features

  • Added @ReturnThis, @OpenForTesting, @EmptySuper and @DeprecatedSinceApi annotations. (21946a2)

  • @ReturnThis (b/140249763): Ensures that overriding methods of this method must return the same instance (intended for builders etc)

  • @OpenForTesting (b/141539024): Kotlin classes and methods marked "open" can be annotated with this annotation, and lint will make sure that this class is only subclassed (and methods only overridden) from unit tests

  • @DeprecatedSinceApi (b/37116481): Indicates that the annotated method (or class or field) is part of a backport library for a platform API, which is no longer needed as of the given API level.

  • @EmptySuper: Indicates that this method is defined to be empty, so when overriding you do not need to call it (and in fact you shouldn't; for example, it can contain backwards compatibility checking.)

Version 1.4.0-alpha01

December 15, 2021

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

API Changes

  • Migrated RestrictTo annotation to Kotlin sources (Ia6336)

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.5

Version 1.5.0-alpha01

August 21, 2024

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

API Changes

  • Add message to RequiresOptIn to match the Kotlin stdlib annotation with default empty string value. (I1f50e)

Annotation-Experimental Version 1.4

Version 1.4.1

April 3, 2024

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

Bug Fixes

  • Fix usage of isKotlin to avoid accidentally triggering RequiresOptIn check in Kotlin files. (I2d8c1f)

Version 1.4.0

January 24, 2024

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

Important changes since 1.3.0

  • Add support for Kotlin multi-platform
  • Fix compatibility with Kotlin 2.0
  • Show warnings for Java usages of experimentally-annotated Kotlin properties (I8bd43)
  • Fix placement of autofix annotation on Kotlin methods (Id7a41)

Version 1.4.0-rc01

January 10, 2024

androidx.annotation:annotation-experimental:1.4.0-rc01 is released. Version 1.4.0-rc01 contains no changes since the previous release.

Version 1.4.0-beta01

December 13, 2023

androidx.annotation:annotation-experimental:1.4.0-beta01 is released. There are no changes since the previous release.

Version 1.4.0-alpha01

November 29, 2023

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

Bug Fixes

  • Temporarily remove class-level autofix suggestions to work around b/301598518. (Id98b2)
  • Show warnings for Java usages of experimentally-annotated Kotlin properties (I8bd43)
  • Fix placement of autofix annotation on Kotlin methods (Id7a41)

Version 1.4.0-dev01

February 8, 2023

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

  • Annotation-experimental has enabled Kotlin multi-platform for developer preview 1.4.0-dev01.

Annotation-Experimental Version 1.3.1

Version 1.3.1

June 21, 2023

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

Bug Fixes

  • Place annotation at the beginning of the modifier list when applying lint auto-fix. (b/251172715)
  • Use lint check to discourage use of androidx.annotation.RequiresOptIn in Kotlin sources (b/241097743)

Annotation-Experimental Version 1.3.0

Version 1.3.0

September 7, 2022

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

Important changes since 1.2.0

  • Add support for package-level use of @androidx.annotation.OptIn (I24d58)
  • Moved Kotlin stdlib dependency to API-type, rather than compile-only. This means all clients of the Annotation-Experimental library will include the Kotlin standard library in their transitive dependencies.

Version 1.3.0-rc01

August 24, 2022

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

  • No changes from the previous release. Implementation has been frozen for RC.

Version 1.3.0-beta01

August 10, 2022

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

  • No changes from alpha. This library has been stabilized for beta release.

Version 1.3.0-alpha01

July 27, 2022

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

API Changes

  • Add support for package-level use of @androidx.annotation.OptIn (I24d58)

Annotation-Experimental Version 1.2.0

Version 1.2.0

December 15, 2021

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

Important changes since 1.1.0

This library is now targeting Java 8 language level.

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 foo.bar:lib1 and foo.baz:lib2 share the prefix foo, they can use each other's APIs that are restricted to this scope. Similarly, for com.foo.bar:lib1 and com.foo.baz:lib2 share the com.foo. prefix and can share APIs restricted to that scope. Library com.bar.qux:lib3 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 android.support.annotation 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)