Didn't find class "om.scwang.smartrefresh.layout.SmartRefreshLayout" on path: DexPathList[[zip file "/data/app/com.paidian.hwmc-EsIbVq6e0mFwE0-rPanqdg==/base.apk", zip file "/data/app/com.paidian.hwmc-EsIbVq6e0mFwE0-rPanqdg==/split_lib_dependencies_apk.apk", zip file "/data/app/com.paidian.hwmc-EsIbVq6e0mFwE0-rPanqdg==/split_lib_slice_0_apk.apk", zip file "/data/app/com.paidian.hwmc-EsIbVq6e0mFwE0-rPanqdg==/split_lib_slice_1_apk.apk", zip file "/data/app/com.paidian.hwmc-EsIbVq6e0mFwE0-rPanqdg==/split_lib_s
com.paidian.hwmc.goods.activity.GoodsDetailsActivity.onCreate(GoodsDetailsActivity.java:209)
java.util.concurrent.TimeoutException: android.view.ThreadedRenderer.finalize() timed out after 10 seconds
at android.view.ThreadedRenderer.nDeleteProxy(Native Method)
at android.view.ThreadedRenderer.finalize(ThreadedRenderer.java:423)
public class TimeoutException extends Exception {
private static final long serialVersionUID = 1900926677490660714L;
public TimeoutException() {}
public TimeoutException(String message) {
super(message);
}
}
C.项目中异常分析
D.引发崩溃日志的流程分析
F.解决办法
一般是系统在gc时,调用对象的finalize超时导致,解决办法:
1.检查分析finalize的实现为什么耗时较高,修复它;
2.检查日志查看GC是否过于频繁,导致超时,减少内容开销,防止内存泄露。
G.其他延申
1.3 java.lang.NumberFormatException格式转化错误
A.详细崩溃日志信息
Exception in thread "main" java.lang.NumberFormatException: For input string: "100 "
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:458)
at java.lang.Integer.parseInt(Integer.java:499)
B.查看崩溃类信息
引发,以指示应用程序试图将字符串转换为数字类型之一,但该字符串没有适当的格式。
public class NumberFormatException extends IllegalArgumentException {
static final long serialVersionUID = -2848938806368998894L;
public NumberFormatException () {
super();
}
public NumberFormatException (String s) {
super (s);
}
static NumberFormatException forInputString(String s) {
return new NumberFormatException("For input string: \"" + s + "\"");
}
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
activity = (MainActivity) context;
}
@Override
public void onDetach() {
super.onDetach();
if (activity != null) {
activity = null;
}
}
G.其他延申
发生场景:该错误经常发生在fragment的线程中执行了一个耗时操作,线程在执行完毕后会调用getResources来更新ui。如果在线程操作没有完成,就调用getActivity().recreate()重新加载activity或屏幕旋转,这时就会出现Fragment not attached to Activity的错误
1.5 ArrayIndexOutOfBoundsException 角标越界异常
A.详细崩溃日志信息
该异常表示数组越界
java.lang.ArrayIndexOutOfBoundsException: 0
at com.example.mytest.CityAdapter.setDataNotify(CityAdapter.java:183)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
B.查看崩溃类信息
引发,以指示已使用非法索引访问数组。索引不是负的,就是大于或等于数组的大小。
public class ArrayIndexOutOfBoundsException extends IndexOutOfBoundsException {
private static final long serialVersionUID = -5116101128118950844L;
public ArrayIndexOutOfBoundsException() {
super();
}
public ArrayIndexOutOfBoundsException(int index) {
super("Array index out of range: " + index);
}
public ArrayIndexOutOfBoundsException(String s) {
super(s);
}
public ArrayIndexOutOfBoundsException(int sourceLength, int index) {
super("length=" + sourceLength + "; index=" + index);
}
public ArrayIndexOutOfBoundsException(int sourceLength, int offset,
int count) {
super("length=" + sourceLength + "; regionStart=" + offset
+ "; regionLength=" + count);
}
}
public class IllegalAccessException extends ReflectiveOperationException {
private static final long serialVersionUID = 6616958222490762034L;
public IllegalAccessException() {
super();
}
public IllegalAccessException(String s) {
super(s);
}
}
Unable to add window -- token android.os.BinderProxy@9a57804 is not valid; is your activity running?
android.view.ViewRootImpl.setView(ViewRootImpl.java:907)
B.查看崩溃类信息
在WindowManager中可以找到这个异常类,主要发生在尝试添加视图时引发的
public static class BadTokenException extends RuntimeException {
public BadTokenException() {
}
public BadTokenException(String name) {
super(name);
}
}