50个Android开发中常见的异常崩溃情况

以下是50个Android开发中常见的异常崩溃情况和对应的异常日志:

NullPointerException:指针为空异常

java.lang.NullPointerException: Attempt to invoke virtual method ‘…’ on a null object reference
ClassCastException:类型转换异常

java.lang.ClassCastException: … cannot be cast to …
IllegalArgumentException:非法参数异常

java.lang.IllegalArgumentException: … is not a valid argument
IllegalStateException:非法状态异常

java.lang.IllegalStateException: … is not in a valid state
IndexOutOfBoundsException:越界异常

java.lang.IndexOutOfBoundsException: Index … out of bounds for length …
OutOfMemoryError:内存溢出错误

java.lang.OutOfMemoryError: Failed to allocate a … byte allocation with … free bytes and …MB until OOM, target footprint …MB, growth limit …MB
NoSuchMethodError:方法不存在错误

java.lang.NoSuchMethodError: … method not found
ArithmeticException:算术异常

java.lang.ArithmeticException: … / by zero
SecurityException:安全异常

java.lang.SecurityException: … not allowed to perform operation
NetworkOnMainThreadException:主线程网络异常

android.os.NetworkOnMainThreadException
InflateException:布局解析异常

android.view.InflateException: Binary XML file line #…: Error inflating class …
ResourcesNotFoundException:资源未找到异常

android.content.res.Resources$NotFoundException: Resource ID #… not found
SQLiteDatabaseLockedException:SQLite数据库锁定异常

android.database.sqlite.SQLiteDatabaseLockedException: database is locked
SQLiteException:SQLite数据库异常

android.database.sqlite.SQLiteException: … error code …
StaleDataException:数据过期异常

android.database.StaleDataException: Attempted to access a cursor after it has been closed.
VerificationError:验证错误

java.lang.VerifyError: … access … from incompatible class …
AssertionError:断言错误

java.lang.AssertionError: … assertion failed
NoSuchAlgorithmException:加密算法不存在异常

java.security.NoSuchAlgorithmException: … algorithm not available
SocketException:Socket异常

java.net.SocketException: … failed: ECONNREFUSED (Connection refused)
SSLException:SSL异常

javax.net.ssl.SSLException: … SSL handshake aborted
FileNotFoundException:文件未找到异常

java.io.FileNotFoundException: … (No such file or directory)
IOException:IO异常

java.io.IOException: … (Connection timed out)
ParseException:解析异常

java.text.ParseException: Unparseable date: “…”
JSONException:JSON解析异常

org.json.JSONException: … at character …
SAXException:SAX解析异常

org.xml.sax.SAXException: … at line …
NumberFormatException:数字格式化异常

java.lang.NumberFormatException: For input string: “…”
IllegalStateException:线程状态异常

java.lang.IllegalStateException: Cannot execute task: the task is already running.
ConcurrentModificationException:并发修改异常

java.util.ConcurrentModificationException: … (java.util.ConcurrentModificationException)
UnsupportedOperationException:不支持的操作异常

java.lang.UnsupportedOperationException: … not supported
InterruptedException:线程中断异常

java.lang.InterruptedException: sleep interrupted
RuntimePermission:权限异常

java.lang.RuntimePermission: … permission required
AuthenticationException:认证异常

org.apache.http.client.ClientProtocolException: … (authentication challenge)
FileNotFoundException:未找到文件异常

java.io.FileNotFoundException: … File not found.
UnsupportedOperationException:不支持的操作异常

java.lang.UnsupportedOperationException: … not supported
EOFException:文件结尾异常

java.io.EOFException: … end of file reached
ConnectException:连接异常

java.net.ConnectException: … Connection refused
SocketTimeoutException:Socket超时异常

java.net.SocketTimeoutException: … Read timed out
JNIException:Java本机接口异常

java.lang.reflect.InvocationTargetException: JNI Exception: …
NoSuchProviderException:提供程序不存在异常

java.security.NoSuchProviderException: Provider … not found
Surface.OutOfResourcesException:Surface资源耗尽异常

android.view.Surface$OutOfResourcesException: … (Surface with no valid EGLContext)
WindowManager.BadTokenException:无效的Window Token异常

android.view.WindowManager$BadTokenException: … is not valid; is your activity running?
TimeoutException:超时异常

java.util.concurrent.TimeoutException: … timeout
SSLHandshakeException:SSL握手异常

javax.net.ssl.SSLHandshakeException: … SSL handshake aborted
SAXParseException:SAX解析异常

org.xml.sax.SAXParseException: … at line …
IllegalStateException:未知的Bundle标记异常

java.lang.IllegalStateException: Unknown Bundle Marker at position …: …
IllegalArgumentException:传递了错误的方位坐标

java.lang.IllegalArgumentException: Point (?, ?) must be in the range ? <= x <= ? and ? <= y <= ?
SQLiteReadOnlyDatabaseException:SQLite只读数据库异常

android.database.sqlite.SQLiteReadOnlyDatabaseException: attempt to write to a readonly database
SQLException:SQL异常

java.sql.SQLException: … SQL exception
ZipException:压缩文件异常

java.util.zip.ZipException: … Not in GZIP format
DifferentKeyException:与此密钥不相关的密钥异常

java.security.spec.InvalidKeySpecException: Inappropriate key specification: Different key pair generated for given keyUsageInfo

猜你喜欢

转载自blog.csdn.net/qq_21399461/article/details/129986709