我有一个设备安卓,例如friendly arm和这是离线。我需要看到这个设备崩溃了。例如,在SD卡中崩溃保存。我可以脱机使用firebase crashlytics并保存到文件中吗?或者使用其他库。我需要一个完整的报告,例如内存,存储,线路崩溃,等等。
发布于 2019-09-26 13:11:27
从技术上讲,您可以自己实现这种机制来跟踪崩溃日志。查看以下要在Application类中处理的代码:
import android.app.Application
class TestApp : Application() {
override fun onCreate() {
super.onCreate()
val exceptionHandler = SimpleExceptionHandler()
Thread.setDefaultUncaughtExceptionHandler(exceptionHandler)
}
}
class SimpleExceptionHandler : Thread.UncaughtExceptionHandler {
override fun uncaughtException(thread: Thread, exc: Throwable) {
// Log your exception here to files, database, etc together with the device status like RAM, processes, network condition that the crash point
}
}您可以选择存储信息的方式,如文本文件、数据库等
https://stackoverflow.com/questions/58107661
复制相似问题