A.詳細崩潰日誌信息php
# main(1) java.lang.UnsatisfiedLinkError dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.paidian.hwmc-1/base.apk", dex file "/data/app/com.paidian.hwmc-1/base.apk"],nativeLibraryDirectories=[/data/app/com.paidian.hwmc-1/lib/arm64, /data/app/com.paidian.hwmc-1/base.apk!/lib/arm64-v8a, /vendor/lib64, /system/lib64]]] couldn't find "libijkffmpeg.so"
B.查看崩潰類信息java
本機
的方法的適當本機語言定義,則引起。public class UnsatisfiedLinkError extends LinkageError { private static final long serialVersionUID = -4019343241616879428L; public UnsatisfiedLinkError() { super(); } public UnsatisfiedLinkError(String s) { super(s); } }
C.項目中異常分析android
F.解決辦法git
報這個錯誤一般是so庫加載失敗,或者找不到準備執行的JNI方法:github
ndk { //根據須要 自行選擇添加的對應cpu類型的.so庫。 //abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'x86', 'mips' abiFilters 'armeabi-v7a' } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) //這兩個是必需要加的,其它的可供選擇 compile 'tv.danmaku.ijk.media:ijkplayer-java:0.8.4' compile 'tv.danmaku.ijk.media:ijkplayer-armv7a:0.8.4' //其餘庫文件 //compile 'tv.danmaku.ijk.media:ijkplayer-armv5:0.8.8' //compile 'tv.danmaku.ijk.media:ijkplayer-arm64:0.8.8' //compile 'tv.danmaku.ijk.media:ijkplayer-x86:0.8.8' //compile 'tv.danmaku.ijk.media:ijkplayer-x86_64:0.8.8' }
A.詳細崩潰日誌信息面試
再給它添加Fragment就會出錯。segmentfault
IllegalStateException: Can not perform this action after onSaveInstanceState:
B.查看崩潰類信息緩存
public class IllegalStateException extends RuntimeException { public IllegalStateException() { super(); } public IllegalStateException(String s) { super(s); } public IllegalStateException(String message, Throwable cause) { super(message, cause); } public IllegalStateException(Throwable cause) { super(cause); } static final long serialVersionUID = -1848914673093119416L; }
C.項目中異常分析安全
F.解決辦法服務器
G.其餘延申
java.lang.IllegalStateException:Can't change tag of fragment d{e183845 #0 d{e183845}}: was d{e183845} now d{e183845 #0 d{e183845}} java.lang.IllegalStateException:Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 37 path $.data
A.詳細崩潰日誌信息
Resource is not a Drawable (color or path): TypedValue{t=0x2/d=0x7f040151 a=2} android.view.LayoutInflater.createView(LayoutInflater.java:620)
B.查看崩潰類信息
public static class NotFoundException extends RuntimeException { public NotFoundException() { } public NotFoundException(String name) { super(name); } public NotFoundException(String name, Exception cause) { super(name, cause); } }
C.項目中異常分析
F.解決辦法
B.查看崩潰類信息
public class IllegalArgumentException extends RuntimeException { public IllegalArgumentException() { super(); } public IllegalArgumentException(String s) { super(s); } public IllegalArgumentException(String message, Throwable cause) { super(message, cause); } public IllegalArgumentException(Throwable cause) { super(cause); } private static final long serialVersionUID = -5365630128856068164L; }
G.常見的出現場景
A.詳細崩潰日誌信息
Can't compress a recycled bitmap com.paidian.hwmc.utils.i.a(FileUtils.java:75)
B.查看崩潰類信息
public boolean compress(CompressFormat format, int quality, OutputStream stream) { checkRecycled("Can't compress a recycled bitmap"); //省略代碼 return result; } //若是位圖已被回收,則但願拋出異常的方法將調用此值。 private void checkRecycled(String errorMessage) { if (mRecycled) { throw new IllegalStateException(errorMessage); } }
C.項目中異常分析
D.引起崩潰日誌的流程分析
Free the native object associated with this bitmap, and clear the reference to the pixel data
F.解決辦法
A.詳細崩潰日誌信息
Please call the AutoSizeConfig#init() first com.paidian.hwmc.base.BaseApplication.initAutoSizeConfig(BaseApplication.java:386)
B.查看崩潰類信息
public class NullPointerException extends RuntimeException { private static final long serialVersionUID = 5162710183389028792L; public NullPointerException() { super(); } public NullPointerException(String s) { super(s); } }
C.項目中異常分析
F.解決辦法
空指針最爲常見,也最容易規避,使用的時候必定要進行null check,採起不信任原則:
A.詳細崩潰日誌信息
android.view.WindowManager$BadTokenException Unable to add window -- token android.os.BinderProxy@7f652b2 is not valid; is your activity running?
B.查看崩潰類信息
D.引起崩潰日誌的流程分析
Toast.makeText(this,"瀟湘劍雨-yc",Toast.LENGTH_SHORT).show(); try { Thread.sleep(20000); } catch (InterruptedException e) { e.printStackTrace(); }
F.解決辦法
第二種,拋出異常增長try-catch,代碼以下所示,最後仍然沒法解決問題
G.哪些狀況會發生該問題?
A.詳細崩潰日誌信息
android.widget.FrameLayout cannot be cast to android.widget.RelativeLayout com.paidian.hwmc.goods.activity.GoodsDetailsActivity.initView(GoodsDetailsActivity.java:712)
B.查看崩潰類信息
public class ClassCastException extends RuntimeException { private static final long serialVersionUID = -9223365651070458532L; public ClassCastException() { super(); } public ClassCastException(String s) { super(s); } }
C.項目中異常分析
F.解決辦法
A.詳細崩潰日誌信息
new Thread(new Runnable() { @Override public void run() { ToastUtils.showRoundRectToast("瀟湘劍雨-楊充"); } }).start();
而後找找報錯日誌從哪裏來的
子線程中吐司的正確作法,代碼以下所示
new Thread(new Runnable() { @Override public void run() { Looper.prepare(); ToastUtils.showRoundRectToast("瀟湘劍雨-楊充"); Looper.loop(); } }).start();
得出的結論