A.詳細崩潰日誌信息php
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)
B.查看崩潰類信息java
public class ClassNotFoundException extends ReflectiveOperationException { private static final long serialVersionUID = 9176873029745254542L; private Throwable ex; public ClassNotFoundException() { super((Throwable)null); // Disallow initCause } public ClassNotFoundException(String s) { super(s, null); // Disallow initCause } public ClassNotFoundException(String s, Throwable ex) { super(s, null); // Disallow initCause this.ex = ex; } public Throwable getException() { return ex; } public Throwable getCause() { return ex; } }
C.項目中異常分析android
F.解決辦法git
若是找不到的Class是應用自由Class(含第三方SDK的Class),能夠經過反編譯工具查看對應apk中是否真的缺乏該Class,再進行定位,這種每每發生在:github
A.詳細崩潰日誌信息面試
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)
B.查看崩潰類信息編程
public class TimeoutException extends Exception { private static final long serialVersionUID = 1900926677490660714L; public TimeoutException() {} public TimeoutException(String message) { super(message); } }
F.解決辦法segmentfault
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.查看崩潰類信息markdown
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 + "\""); } }
C.項目中異常分析
F.解決辦法
A.詳細崩潰日誌信息
java.lang.IllegalStateException: Fragment not attached to Activity
C.項目中異常分析
F.解決辦法
if(isAdded()){//isAdded方法是Android系統提供的,只有在Fragment被添加到所屬的Activity後才返回true activity.getResourses().getString(...); }
@Override public void onAttach(Context context) { super.onAttach(context); activity = (MainActivity) context; } @Override public void onDetach() { super.onDetach(); if (activity != null) { activity = null; } }
G.其餘延申
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); } }
F.解決辦法
A.詳細崩潰日誌信息
Unable to instantiate application com.pedaily.yc.meblurry.App: java.lang.IllegalAccessException
B.查看崩潰類信息
public class IllegalAccessException extends ReflectiveOperationException { private static final long serialVersionUID = 6616958222490762034L; public IllegalAccessException() { super(); } public IllegalAccessException(String s) { super(s); } }
C.項目中異常分析
F.解決辦法
G.其餘延申
A.詳細崩潰日誌信息
Unable to add window -- token android.os.BinderProxy@9a57804 is not valid; is your activity running? android.view.ViewRootImpl.setView(ViewRootImpl.java:907)
B.查看崩潰類信息
public static class BadTokenException extends RuntimeException { public BadTokenException() { } public BadTokenException(String name) { super(name); } }
C.項目中異常分析
F.解決辦法
/** * 展現加載窗 * @param context 上下文 * @param isCancel 是否能夠取消 */ public static void show(Context context, boolean isCancel) { if(context == null){ return; } if (context instanceof Activity) { if (((Activity) context).isFinishing()) { return; } } if (loadDialog != null && loadDialog.isShowing()) { return; } loadDialog = new LoadLayoutDialog(context, isCancel); loadDialog.show(); } /** * 銷燬加載窗 * @param context 上下文 */ public static void dismiss(Context context) { if(context == null){ return; } try { if (context instanceof Activity) { if (((Activity) context).isFinishing()) { loadDialog = null; return; } } if (loadDialog != null && loadDialog.isShowing()) { Context loadContext = loadDialog.getContext(); if (loadContext instanceof Activity) { if (((Activity) loadContext).isFinishing()) { loadDialog = null; return; } } loadDialog.dismiss(); loadDialog = null; } } catch (Exception e) { e.printStackTrace(); loadDialog = null; } }
G.其餘延申
Dialog&AlertDialog,Toast,WindowManager不能正確使用時,常常會報出該異常,緣由比較多,幾個常見的場景以下:
B.查看崩潰類信息
ClassLoader
實例試圖加載類的定義(做爲普通方法調用的一部分或使用新的
表達式建立新實例的一部分),則拋出該類的定義。編譯當前執行的類時存在搜索類定義,但沒法再找到該定義。public class NoClassDefFoundError extends LinkageError { private static final long serialVersionUID = 9095859863287012458L; public NoClassDefFoundError() { super(); } public NoClassDefFoundError(String s) { super(s); } private NoClassDefFoundError(String detailMessage, Throwable throwable) { super(detailMessage, throwable); } }
C.項目中異常分析
D.引起崩潰日誌的流程分析
F.解決辦法
G.其餘延申
[解決方案]:NoClassDefFoundError異常通常出如今編譯環境和運行環境不一致的狀況下,就是說有可能在編譯事後更改了Classpath或者jar包因此致使在運行的過程當中JVM或者ClassLoader沒法找到這個類的定義。
F.解決辦法