{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

SdkSuppress

@Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)  @Target(value = [java.lang.annotation.ElementType.TYPE, java.lang.annotation.ElementType.METHOD]) annotation SdkSuppress


Indicates that a specific test or class requires a minimum or maximum API Level to execute.

Test(s) will be skipped when executed on android platforms less/more than specified level (inclusive).

Summary

Public methods

abstract @NonNull String

The android.os.Build.VERSION.CODENAME to execute on.

abstract @NonNull int

The maximum API level to execute (inclusive)

abstract @NonNull int

The minimum API level to execute (inclusive)

Public methods

codeName

@NonNull
public abstract String codeName()

The android.os.Build.VERSION.CODENAME to execute on. This is intended to be used to run on a pre-release SDK, where the android.os.Build.VERSION.SDK_INT has not yet been finalized. This is treated as an OR operation with respect to the minSdkVersion and maxSdkVersion attributes.

For example, to filter a test so it runs on only the prerelease R SDK:

@
SdkSuppress(minSdkVersion = Build.VERSION_CODES.R, codeName = "R")

maxSdkVersion

@NonNull
public abstract int maxSdkVersion()

The maximum API level to execute (inclusive)

minSdkVersion

@NonNull
public abstract int minSdkVersion()

The minimum API level to execute (inclusive)