Android Studio生成错误日志方法
Use the Android Debugger to get a crash dump.
-
On the Android device navigate to Settings > Developer options > enable USB debugging (打开开发者人员选项中的usb调试) -
Connect the Android device to computer with USB(用USB连接手机和电脑) -
Download the Android SDK Platform Tools: Android Studio > Tools> SDK Manager > Android SDK > SDK Tools > Android SDK Platform-Tools (下载 Android SDK Platform Tools) -
If on windows navigate to - C:\Users\[user]\AppData\Local\Android\sdk\platform-tools (在Android Studio的terminal中cd到Android SDK Platform Tools的下载目录,里面有adb.exe,可以用everything查找adb.exe) If on mac navigate to /Users/[user]/Library/Android/sdk/platform-tools
-
Run the App and crash the app(启动APP让其崩溃) -
From the terminal run: ./adb logcat -v threadtime -d > /path_to_random_text_file_for_crash_dump/test.txt
path_to_random_text_file_for_crash_dump可以自定义
也可以放在当前目录adb logcat -v threadtime -d > test.txt
A more detailed error should be in the test.txt .(查看crash dump文件)
在github提交issue时可能test.txt过大,可以新建一个github仓库存放test.txt ,然后把github仓库存放的test.txt 以链接的形式放在issue中,例如
https://github.com/douzaikongcheng/log/blob/main/test.txt
|