Android 开发常见异常分类

来源:互联网 发布:linux设置后不为中文 编辑:程序博客网 时间:2024/06/05 20:31
  1. ANR(Application Not Responding)
    发生该异常时,Android 设备通常会弹出“程序XXX无响应,是否等待”的提示框。
    常见发生原因:
    1)应用主线程卡住,对其他请求响应超时;
    2)死锁;
    3)系统反应迟钝;
    4)CPU 负载过重。

  2. Java runtime error
    发生该异常时,Android 设备通常会弹出“程序 XXX 意外终止,是否立即关闭”的提示框。
    常见错误:
    1)NullPointerException;
    2)IndexOutofBoundsException;
    3)IllegalArgumentException;
    4)IllegalStateException。

  3. NDK Error(Native Development Kit)
    发生该异常时,程序在 Android 设备上都会立即退出,即通常所说的闪退,而不会弹出提示框。常见错误:
    1)初始化错误;
    2)访问错误;
    3)内存泄露;
    4)参数错误;
    5)堆栈溢出;
    6)数字除 0 错误


学习自 Testin http://crash.testin.cn/

0 0
原创粉丝点击