Added in API level 1

RuntimeException

open class RuntimeException : Exception
AconfigStorageReadException

Exception thrown when an error occurs while reading from Aconfig Storage.

ActivityNotFoundException

This exception is thrown when a call to android.

AndroidRuntimeException

Base class for all unchecked exceptions thrown by the Android frameworks.

AnnotationTypeMismatchException

Thrown to indicate that a program has attempted to access an element of an annotation whose type has changed after the annotation was compiled (or serialized).

ArithmeticException

Thrown when an exceptional arithmetic condition has occurred.

ArrayStoreException

Thrown to indicate that an attempt has been made to store the wrong type of object into an array of objects.

BufferOverflowException

Unchecked exception thrown when a relative put operation reaches the target buffer's limit.

BufferUnderflowException

Unchecked exception thrown when a relative get operation reaches the source buffer's limit.

CallEndpointException

This class represents a set of exceptions that can occur when requesting a CallEndpoint change.

CallException

This class defines exceptions that can be thrown when using Telecom APIs with android.os.OutcomeReceivers.

ClassCastException

Thrown to indicate that the code has attempted to cast an object to a subclass of which it is not an instance.

CompanionException

CompanionException can be thrown during the companion system data transfer process.

CompletionException

Exception thrown when an error or other exception is encountered in the course of completing a result or task.

ConcurrentModificationException

This exception may be thrown by methods that have detected concurrent modification of an object when such modification is not permissible.

CursorWindowAllocationException

This exception is thrown when a CursorWindow couldn't be allocated, most probably due to memory not being available.

DOMException

DOM operations only raise exceptions in "exceptional" circumstances, i.

DateTimeException

Exception used to indicate a problem while calculating a date-time.

DeviceNotAssociatedException

An exception for a case when a given device was not android.

EmptyStackException

Thrown by methods in the Stack class to indicate that the stack is empty.

EnumConstantNotPresentException

Thrown when an application tries to access an enum constant by name and the enum type contains no constant with the specified name.

FileSystemAlreadyExistsException

Runtime exception thrown when an attempt is made to create a file system that already exists.

FileSystemNotFoundException

Runtime exception thrown when a file system cannot be found.

FileUriExposedException

The exception that is thrown when an application exposes a file:// android.net.Uri to another app.

GLException

An exception class for OpenGL errors.

HealthConnectException

Class representing health connect exceptions.

ICUUncheckedIOException

Unchecked version of java.io.IOException.

IllegalArgumentException

Thrown to indicate that a method has been passed an illegal or inappropriate argument.

IllegalMonitorStateException

Thrown to indicate that a thread has attempted to wait on an object's monitor or to notify other threads waiting on an object's monitor without owning the specified monitor.

IllegalStateException

Signals that a method has been invoked at an illegal or inappropriate time.

IllformedLocaleException

Thrown by methods in ULocale and ULocale.Builder to indicate that an argument is not a well-formed BCP 47 tag.

IllformedLocaleException

Thrown by methods in Locale and Locale.Builder to indicate that an argument is not a well-formed BCP 47 tag.

IncompleteAnnotationException

Thrown to indicate that a program has attempted to access an element of an annotation interface that was added to the annotation interface definition after the annotation was compiled (or serialized).

IndexOutOfBoundsException

Thrown to indicate that an index of some sort (such as to an array, to a string, or to a vector) is out of range.

InflateException

This exception is thrown by an inflater on error conditions.

InspectionCompanion.UninitializedPropertyMapException

Thrown by readProperties(java.lang.Object,android.view.inspector.PropertyReader) if called before mapProperties(android.view.inspector.PropertyMapper).

LSException

Parser or write operations may throw an LSException if the processing is stopped.

MalformedParameterizedTypeException

Thrown when a semantically malformed parameterized type is encountered by a reflective method that needs to instantiate it.

MalformedParametersException

Thrown when the attempts to read method parameters from a class file and determines that one or more parameters are malformed.

MatchException

Thrown to indicate an unexpected failure in pattern matching.

MediaCodec.CryptoException

Thrown when a crypto error occurs while queueing a secure input buffer.

MediaCodec.IncompatibleWithBlockModelException

Thrown when the codec is configured for block model and an incompatible API is called.

MediaCodec.InvalidBufferFlagsException

Thrown when a buffer is marked with an invalid combination of flags (e.g. both

MediaDrm.SessionException

SessionException is a misnomer because it may occur in methods without a session context.

MissingResourceException

Signals that a resource is missing.

NegativeArraySizeException

Thrown if an application tries to create an array with negative size.

NetworkOnMainThreadException

The exception that is thrown when an application attempts to perform a networking operation on its main thread.

NoSuchElementException

Thrown by various accessor methods to indicate that the element being requested does not exist.

NoSuchPropertyException

Thrown when code requests a Property on a class that does not expose the appropriate method or field.

NullPointerException

Thrown when an application attempts to use null in a case where an object is required.

OperationCanceledException

An exception type that is thrown when an operation in progress is canceled.

ParcelFormatException

The contents of a Parcel (usually during unmarshalling) does not contain the expected data.

ParseException

Thrown when parsing failed.

PropertyMapper.PropertyConflictException

Thrown from a map method if a property name is already mapped as different type.

PropertyReader.PropertyTypeMismatchException

Thrown if a client calls a typed read method for a property of a different type.

ProviderException

A runtime exception for Provider exceptions (such as misconfiguration errors or unrecoverable internal errors), which may be subclassed by Providers to throw specialized, provider-specific runtime errors.

ProviderNotFoundException

Runtime exception thrown when a provider of the required type cannot be found.

QueryLocationException

This class represents a set of exceptions that can occur when requesting a Connection.queryLocationForEmergency(long, String, Executor, OutcomeReceiver)

RSRuntimeException

Base class for all exceptions thrown by the Android RenderScript

RejectedExecutionException

Exception thrown by an Executor when a task cannot be accepted for execution.

RemoteViews.ActionException

Exception to send when something goes wrong executing an action

Resources.NotFoundException

This exception is thrown by the resource APIs when a requested resource can not be found.

SQLException

An exception that indicates there was an error with SQL parsing or execution.

SecurityException

Thrown by the security manager to indicate a security violation.

StaleDataException

This exception is thrown when a Cursor contains stale data and must be requeried before being used again.

Surface.OutOfResourcesException

Exception thrown when a Canvas couldn't be locked with Surface.lockCanvas, or when a SurfaceTexture could not successfully be allocated.

SurfaceHolder.BadSurfaceTypeException

Exception that is thrown from #lockCanvas when called on a Surface whose type is SURFACE_TYPE_PUSH_BUFFERS.

TimeFormatException

TypeNotPresentException

Thrown when an application tries to access a type using a string representing the type's name, but no definition for the type with the specified name can be found.

UncheckedIOException

Wraps an IOException with an unchecked exception.

UndeclaredThrowableException

Thrown by a method invocation on a proxy instance if its invocation handler's invoke method throws a checked exception (a Throwable that is not assignable to RuntimeException or Error) that is not assignable to any of the exception types declared in the throws clause of the method that was invoked on the proxy instance and dispatched to the invocation handler.

UnsupportedOperationException

Thrown to indicate that the requested operation is not supported.

UserManager.UserOperationException

Thrown to indicate user operation failed.

WindowManager.BadTokenException

Exception that is thrown when trying to add view whose LayoutParams LayoutParams.token is invalid.

WindowManager.InvalidDisplayException

Exception that is thrown when calling addView to a secondary display that cannot be found.

WrongMethodTypeException

Thrown to indicate that code has attempted to call a method handle via the wrong method type.

AcceptPendingException

Unchecked exception thrown when an attempt is made to initiate an accept operation on a channel and a previous accept operation has not completed.

AccessControlException

This exception is thrown by the AccessController to indicate that a requested access (to a critical system resource such as the file system or the network) is denied.

AlreadyBoundException

Unchecked exception thrown when an attempt is made to bind the socket a network oriented channel that is already bound.

AlreadyConnectedException

Unchecked exception thrown when an attempt is made to connect a SocketChannel that is already connected.

ArrayIndexOutOfBoundsException

Thrown to indicate that an array has been accessed with an illegal index.

AuthenticationRequiredException

Specialization of SecurityException that is thrown when authentication is needed from the end user before viewing the content.

BackendBusyException

Indicates a transient error that prevented a key operation from being created.

BackgroundServiceStartNotAllowedException

Exception thrown when an app tries to start a background Service when it's not allowed to do so.

BadParcelableException

Exception thrown when a Parcelable is malformed or otherwise invalid.

CancellationException

Exception indicating that the result of a value-producing task, such as a FutureTask, cannot be retrieved because the task was cancelled.

CancelledKeyException

Unchecked exception thrown when an attempt is made to use a selection key that is no longer valid.

ClosedDirectoryStreamException

Unchecked exception thrown when an attempt is made to invoke an operation on a directory stream that is closed.

ClosedFileSystemException

Unchecked exception thrown when an attempt is made to invoke an operation on a file and the file system is closed.

ClosedSelectorException

Unchecked exception thrown when an attempt is made to invoke an I/O operation upon a closed selector.

ClosedWatchServiceException

Unchecked exception thrown when an attempt is made to invoke an operation on a watch service that is closed.

ConnectionPendingException

Unchecked exception thrown when an attempt is made to connect a SocketChannel for which a non-blocking connection operation is already in progress.

CursorIndexOutOfBoundsException

An exception indicating that a cursor is out of bounds.

DateTimeParseException

An exception thrown when an error occurs during parsing.

DirectoryIteratorException

Runtime exception thrown if an I/O error is encountered when iterating over the entries in a directory.

DuplicateFormatFlagsException

Unchecked exception thrown when duplicate flags are provided in the format specifier.

ForegroundServiceStartNotAllowedException

Exception thrown when an app tries to start a foreground Service when it's not allowed to do so.

ForegroundServiceTypeException

Base exception thrown when an app tries to start a foreground Service without a valid type.

FormatFlagsConversionMismatchException

Unchecked exception thrown when a conversion and flag are incompatible.

FormatterClosedException

Unchecked exception thrown when the formatter has been closed.

Fragment.InstantiationException

Thrown by Fragment.instantiate(Context, String, Bundle) when there is an instantiation failure.

IllegalBlockingModeException

Unchecked exception thrown when a blocking-mode-specific operation is invoked upon a channel in the incorrect blocking mode.

IllegalChannelGroupException

Unchecked exception thrown when an attempt is made to open a channel in a group that was not created by the same provider.

IllegalCharsetNameException

Unchecked exception thrown when a string that is not a legal charset name is used as such.

IllegalFormatCodePointException

Unchecked exception thrown when a character with an invalid Unicode code point as defined by Character.isValidCodePoint is passed to the Formatter.

IllegalFormatConversionException

Unchecked exception thrown when the argument corresponding to the format specifier is of an incompatible type.

IllegalFormatException

Unchecked exception thrown when a format string contains an illegal syntax or a format specifier that is incompatible with the given arguments.

IllegalFormatFlagsException

Unchecked exception thrown when an illegal combination flags is given.

IllegalFormatPrecisionException

Unchecked exception thrown when the precision is a negative value other than -1, the conversion does not support a precision, or the value is otherwise unsupported.

IllegalFormatWidthException

Unchecked exception thrown when the format width is a negative value other than -1 or is otherwise unsupported.

IllegalSelectorException

Unchecked exception thrown when an attempt is made to register a channel with a selector that was not created by the provider that created the channel.

IllegalThreadStateException

Thrown to indicate that a thread is not in an appropriate state for the requested operation.

InlineExecutionProhibitedException

Thrown when an executor runs a submitted runnable inline in java.util.concurrent.Executor#execute(Runnable) and android.net.http.UrlRequest.Builder#setDirectExecutorAllowed was not called.

InputMismatchException

Thrown by a Scanner to indicate that the token retrieved does not match the pattern for the expected type, or that the token is out of range for the expected type.

InvalidForegroundServiceTypeException

Exception thrown when an app tries to start a foreground Service with an invalid type.

InvalidMarkException

Unchecked exception thrown when an attempt is made to reset a buffer when its mark is not defined.

InvalidParameterException

This exception, designed for use by the JCA/JCE engine classes, is thrown when an invalid parameter is passed to a method.

InvalidPathException

Unchecked exception thrown when path string cannot be converted into a Path because the path string contains invalid characters, or the path string is invalid for other file system specific reasons.

KeyCharacterMap.UnavailableException

Thrown by KeyCharacterMap.load when a key character map could not be loaded.

LimitExceededException

Indicates that the app has exceeded a limit set by the System.

MediaCasStateException

Base class for MediaCas runtime exceptions

MediaCodec.CodecException

Thrown when an internal codec error occurs.

MediaDrm.MediaDrmStateException

Thrown when a general failure occurs during a MediaDrm operation.

MediaDrmResetException

This exception is thrown when the MediaDrm instance has become unusable due to a restart of the mediaserver process.

MissingForegroundServiceTypeException

Exception thrown when an app tries to start a foreground Service without a type.

MissingFormatArgumentException

Unchecked exception thrown when there is a format specifier which does not have a corresponding argument or if an argument index refers to an argument that does not exist.

MissingFormatWidthException

Unchecked exception thrown when the format width is required.

NoConnectionPendingException

Unchecked exception thrown when the finishConnect method of a SocketChannel is invoked without first successfully invoking its connect method.

NonReadableChannelException

Unchecked exception thrown when an attempt is made to read from a channel that was not originally opened for reading.

NonWritableChannelException

Unchecked exception thrown when an attempt is made to write to a channel that was not originally opened for writing.

NotYetBoundException

Unchecked exception thrown when an attempt is made to invoke an I/O operation upon a server socket channel that is not yet bound.

NotYetConnectedException

Unchecked exception thrown when an attempt is made to invoke an I/O operation upon a socket channel that is not yet connected.

NumberFormatException

Thrown to indicate that the application has attempted to convert a string to one of the numeric types, but that the string does not have the appropriate format.

OverlappingFileLockException

Unchecked exception thrown when an attempt is made to acquire a lock on a region of a file that overlaps a region already locked by the same Java virtual machine, or when another thread is already waiting to lock an overlapping region of the same file.

PatternSyntaxException

Unchecked exception thrown to indicate a syntax error in a regular-expression pattern.

ProviderMismatchException

Unchecked exception thrown when an attempt is made to invoke a method on an object created by one file system provider with a parameter created by a different file system provider.

RSDriverException

Base class for all exceptions thrown by the Android RenderScript

RSIllegalArgumentException

Base class for all exceptions thrown by the Android RenderScript

RSInvalidStateException

Base class for all exceptions thrown by the Android RenderScript

ReadOnlyBufferException

Unchecked exception thrown when a content-mutation method such as put or compact is invoked upon a read-only buffer.

ReadOnlyFileSystemException

Unchecked exception thrown when an attempt is made to update an object associated with a read-only FileSystem.

ReadPendingException

Unchecked exception thrown when an attempt is made to read from an asynchronous socket channel and a previous read has not completed.

ReceiverCallNotAllowedException

This exception is thrown from android.

RecoverableSecurityException

Specialization of SecurityException that contains additional information about how to involve the end user to recover from the exception.

SQLiteAbortException

An exception that indicates that the SQLite program was aborted.

SQLiteAccessPermException

This exception class is used when sqlite can't access the database file due to lack of permissions on the file.

SQLiteBindOrColumnIndexOutOfRangeException

Thrown if the bind or column parameter index is out of range.

SQLiteBlobTooBigException

SQLiteCantOpenDatabaseException

SQLiteConstraintException

An exception that indicates that an integrity constraint was violated.

SQLiteDatabaseCorruptException

An exception that indicates that the SQLite database file is corrupt.

SQLiteDatabaseLockedException

Thrown if the database engine was unable to acquire the database locks it needs to do its job.

SQLiteDatatypeMismatchException

SQLiteDiskIOException

Indicates that an IO error occurred while accessing the SQLite database file.

SQLiteDoneException

An exception that indicates that the SQLite program is done.

SQLiteException

A SQLite exception that indicates there was an error with SQL parsing or execution.

SQLiteFullException

An exception that indicates that the SQLite database is full.

SQLiteMisuseException

This error can occur if the application creates a SQLiteStatement object and allows multiple threads in the application use it at the same time.

SQLiteOutOfMemoryException

SQLiteReadOnlyDatabaseException

SQLiteTableLockedException

SecureKeyImportUnavailableException

Indicates that the Keystore does not support securely importing wrapped keys.

ServiceStartNotAllowedException

Exception thrown when an app tries to start a Service when it's not allowed to do so.

ShutdownChannelGroupException

Unchecked exception thrown when an attempt is made to construct a channel in a group that is shutdown or the completion handler for an I/O operation cannot be invoked because the channel group has terminated.

StartForegroundCalledOnStoppedServiceException

Exception thrown when android.

StringIndexOutOfBoundsException

Thrown by String methods to indicate that an index is either negative or greater than the size of the string.

StrongBoxUnavailableException

Indicates that an operation could not be performed because the requested security hardware is not available.

SystemUpdatePolicy.ValidationFailedException

An exception class that represents various validation errors thrown from SystemUpdatePolicy.setFreezePeriods and DevicePolicyManager.setSystemUpdatePolicy

UnknownFormatConversionException

Unchecked exception thrown when an unknown conversion is given.

UnknownFormatFlagsException

Unchecked exception thrown when an unknown flag is given.

UnresolvedAddressException

Unchecked exception thrown when an attempt is made to invoke a network operation upon an unresolved socket address.

UnsafeStateException

Exception thrown when a android.app.admin.DevicePolicyManager operation failed because it was not safe to be executed at that moment.

UnsupportedAddressTypeException

Unchecked exception thrown when an attempt is made to bind or connect to a socket address of a type that is not supported.

UnsupportedCharsetException

Unchecked exception thrown when no support is available for a requested charset.

UnsupportedTemporalTypeException

UnsupportedTemporalTypeException indicates that a ChronoField or ChronoUnit is not supported for a Temporal class.

WritePendingException

Unchecked exception thrown when an attempt is made to write to an asynchronous socket channel and a previous write has not completed.

ZoneRulesException

Thrown to indicate a problem with time-zone configuration.

RuntimeException is the superclass of those exceptions that can be thrown during the normal operation of the Java Virtual Machine.

RuntimeException and its subclasses are unchecked exceptions. Unchecked exceptions do not need to be declared in a method or constructor's throws clause if they can be thrown by the execution of the method or constructor and propagate outside the method or constructor boundary.

Summary

Public constructors

Constructs a new runtime exception with null as its detail message.

Constructs a new runtime exception with the specified detail message.

RuntimeException(message: String!, cause: Throwable!)

Constructs a new runtime exception with the specified detail message and cause.

Constructs a new runtime exception with the specified cause and a detail message of (cause==null ? null : cause.toString()) (which typically contains the class and detail message of cause).

Protected constructors
RuntimeException(message: String!, cause: Throwable!, enableSuppression: Boolean, writableStackTrace: Boolean)

Constructs a new runtime exception with the specified detail message, cause, suppression enabled or disabled, and writable stack trace enabled or disabled.

Public constructors

RuntimeException

Added in API level 1
RuntimeException()

Constructs a new runtime exception with null as its detail message. The cause is not initialized, and may subsequently be initialized by a call to initCause.

RuntimeException

Added in API level 1
RuntimeException(message: String!)

Constructs a new runtime exception with the specified detail message. The cause is not initialized, and may subsequently be initialized by a call to initCause.

Parameters
message String!: the detail message. The detail message is saved for later retrieval by the getMessage() method.

RuntimeException

Added in API level 1
RuntimeException(
    message: String!,
    cause: Throwable!)

Constructs a new runtime exception with the specified detail message and cause.

Note that the detail message associated with cause is not automatically incorporated in this runtime exception's detail message.

Parameters
message String!: the detail message (which is saved for later retrieval by the getMessage() method).
cause Throwable!: the cause (which is saved for later retrieval by the getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)

RuntimeException

Added in API level 1
RuntimeException(cause: Throwable!)

Constructs a new runtime exception with the specified cause and a detail message of (cause==null ? null : cause.toString()) (which typically contains the class and detail message of cause). This constructor is useful for runtime exceptions that are little more than wrappers for other throwables.

Parameters
cause Throwable!: the cause (which is saved for later retrieval by the getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)

Protected constructors

RuntimeException

Added in API level 24
protected RuntimeException(
    message: String!,
    cause: Throwable!,
    enableSuppression: Boolean,
    writableStackTrace: Boolean)

Constructs a new runtime exception with the specified detail message, cause, suppression enabled or disabled, and writable stack trace enabled or disabled.

Parameters
message String!: the detail message.
cause Throwable!: the cause. (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
enableSuppression Boolean: whether or not suppression is enabled or disabled
writableStackTrace Boolean: whether or not the stack trace should be writable