Added in API level 1

Build.VERSION


public static class Build.VERSION
extends Object

java.lang.Object
   ↳ android.os.Build.VERSION


Various version strings.

Summary

Fields

public static final String BASE_OS

The base OS build the product is based on.

public static final String CODENAME

The current development codename, or the string "REL" if this is a release build.

public static final String INCREMENTAL

The internal value used by the underlying source control to represent this build.

public static final int MEDIA_PERFORMANCE_CLASS

The media performance class of the device or 0 if none.

public static final int PREVIEW_SDK_INT

The developer preview revision of a prerelease SDK.

public static final String RELEASE

The user-visible version string.

public static final String RELEASE_OR_CODENAME

The version string.

public static final String RELEASE_OR_PREVIEW_DISPLAY

The version string we show to the user; may be RELEASE or a descriptive string if not a final release build.

public static final String SDK

This field was deprecated in API level 15. Use SDK_INT to easily get this as an integer.

public static final int SDK_INT

The SDK version of the software currently running on this hardware device.

public static final String SECURITY_PATCH

The user-visible security patch level.

Public constructors

VERSION()

Inherited methods

Fields

BASE_OS

Added in API level 23
public static final String BASE_OS

The base OS build the product is based on.

CODENAME

Added in API level 4
public static final String CODENAME

The current development codename, or the string "REL" if this is a release build.

INCREMENTAL

Added in API level 1
public static final String INCREMENTAL

The internal value used by the underlying source control to represent this build. E.g., a perforce changelist number or a git hash.

MEDIA_PERFORMANCE_CLASS

Added in API level 31
public static final int MEDIA_PERFORMANCE_CLASS

The media performance class of the device or 0 if none.

If this value is not 0, the device conforms to the media performance class definition of the SDK version of this value. This value never changes while a device is booted, but it may increase when the hardware manufacturer provides an OTA update.

Possible non-zero values are defined in Build.VERSION_CODES starting with Build.VERSION_CODES#R.

PREVIEW_SDK_INT

Added in API level 23
public static final int PREVIEW_SDK_INT

The developer preview revision of a prerelease SDK. This value will always be 0 on production platform builds/devices.

When this value is nonzero, any new API added since the last officially published API level is only guaranteed to be present on that specific preview revision. For example, an API Activity.fooBar() might be present in preview revision 1 but renamed or removed entirely in preview revision 2, which may cause an app attempting to call it to crash at runtime.

Experimental apps targeting preview APIs should check this value for equality (==) with the preview SDK revision they were built for before using any prerelease platform APIs. Apps that detect a preview SDK revision other than the specific one they expect should fall back to using APIs from the previously published API level only to avoid unwanted runtime exceptions.

RELEASE

Added in API level 1
public static final String RELEASE

The user-visible version string. E.g., "1.0" or "3.4b5" or "bananas". This field is an opaque string. Do not assume that its value has any particular structure or that values of RELEASE from different releases can be somehow ordered.

RELEASE_OR_CODENAME

Added in API level 30
public static final String RELEASE_OR_CODENAME

The version string. May be RELEASE or CODENAME if not a final release build.

RELEASE_OR_PREVIEW_DISPLAY

Added in API level 33
public static final String RELEASE_OR_PREVIEW_DISPLAY

The version string we show to the user; may be RELEASE or a descriptive string if not a final release build.

SDK

Added in API level 1
Deprecated in API level 15
public static final String SDK

This field was deprecated in API level 15.
Use SDK_INT to easily get this as an integer.

The user-visible SDK version of the framework in its raw String representation; use SDK_INT instead.

SDK_INT

Added in API level 4
public static final int SDK_INT

The SDK version of the software currently running on this hardware device. This value never changes while a device is booted, but it may increase when the hardware manufacturer provides an OTA update.

Possible values are defined in Build.VERSION_CODES.

SECURITY_PATCH

Added in API level 23
public static final String SECURITY_PATCH

The user-visible security patch level. This value represents the date when the device most recently applied a security patch.

Public constructors

VERSION

public VERSION ()