publicclassCrashTestReport{publicstaticvoidinit(Context application){TestCrashHandler.init(application);}/**
* RuntimeException
*/publicstaticvoidtest1(){int i =1/0;}/**
* StackOverflowError
*/publicstaticvoidtest2(){test2();}}
2.3 文件里的Crash信息
test1方法测试结果,RuntimeException。
Crash_Time:2021-06-0422:43:56App_VersionName:1.0App_VersionCode:1Android_Version:10Android_VersionCode:29Vendor: HUAWEI
Phone_Model: VOG-AL00
CPU :[arm64-v8a, armeabi-v7a, armeabi]Thread: main
Exception:java.lang.RuntimeException:Unabletostart activity ComponentInfo{com.bao.myapplication/com.bao.myapplication.MainActivity}:java.lang.ArithmeticException: divide by zero
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3898)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4081)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:91)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:149)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:103)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2462)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:219)
at android.app.ActivityThread.main(ActivityThread.java:8393)
at java.lang.reflect.Method.invoke(NativeMethod)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1055)Caused by:java.lang.ArithmeticException: divide by zero
at com.bao.myapplication.carsh.CrashTestReport.test1(CrashTestReport.java:11)
at com.bao.myapplication.MainActivity.onCreate(MainActivity.kt:79)
at android.app.Activity.performCreate(Activity.java:8121)
at android.app.Activity.performCreate(Activity.java:8109)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1320)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3871)...11 more
test2 方法测试结果,StackOverflowError。
Crash_Time:2021-06-0500:49:39App_VersionName:1.0App_VersionCode:1Android_Version:10Android_VersionCode:29Vendor: HUAWEI
Phone_Model: VOG-AL00
CPU :[arm64-v8a, armeabi-v7a, armeabi]Thread: main
Exception:java.lang.StackOverflowError: stack size 8192KB
at com.bao.myapplication.carsh.CrashTestReport.test2(CrashTestReport.java:15)
at com.bao.myapplication.carsh.CrashTestReport.test2(CrashTestReport.java:15)
at com.bao.myapplication.carsh.CrashTestReport.test2(CrashTestReport.java:15)..
at com.bao.myapplication.carsh.CrashTestReport.test2(CrashTestReport.java:15)
at com.bao.myapplication.carsh.CrashTestReport.test2(CrashTestReport.java:15)
at com.bao.myapplication.MainActivity.onCreate(MainActivity.kt:79)
at android.app.Activity.performCreate(Activity.java:8121)
at android.app.Activity.performCreate(Activity.java:8109)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1320)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3871)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4081)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:91)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:149)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:103)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2462)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:219)
at android.app.ActivityThread.main(ActivityThread.java:8393)
at java.lang.reflect.Method.invoke(NativeMethod)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1055)