java.lang.NullPointerException
Attempt to invoke virtual method 'java.lang.String java.lang.Object.toString()' on a null object reference
com.simple.spiderman.CrashActivity.onCreate(CrashActivity.java:55)
在kotlin协程崩溃捕获不到,会导致CrashActivity崩溃,显示的崩溃信息:
java.lang.RuntimeException:Unable to start activity ComponentInfo{com.sanyesan.share/com.simple.spiderman.CrashActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Object.toString()' on a null object reference
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3712)
......
Caused by:
java.lang.NullPointerException:Attempt to invoke virtual method 'java.lang.String java.lang.Object.toString()' on a null object reference
java.lang.String.valueOf(String.java:4092)
java.lang.StringBuilder.append(StringBuilder.java:179)
java.lang.Throwable.printEnclosedStackTrace(Throwable.java:727)
java.lang.Throwable.printStackTrace(Throwable.java:692)
java.lang.Throwable.printStackTrace(Throwable.java:753)
android.util.Log.getStackTraceString(Log.java:371)
com.simple.spiderman.CrashActivity.onCreate(CrashActivity.java:55)
android.app.Activity.performCreate(Activity.java:8290)
android.app.Activity.performCreate(Activity.java:8269)
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1384)
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3693)
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3849)
android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
在kotlin协程崩溃捕获不到,会导致CrashActivity崩溃,显示的崩溃信息:
案例代码:ViewModel 中