①E/ART: Failed sending reply to debugger: Broken pipe.
What is a broken pipe?
Your dev machine and the Android device communicate like a client server and a broken pipe means that the communication has become invalid. For instance, the client (the Android device) is trying to send a reply to the server (the adb process running on the dev machine) but the server has already closed the socket.
如何修复
First make sure your app is building correctly by performing a clean/rebuild.
Then if you are running your app using USB debugging on a real phone then you can often fix the problem by unplugging the USB cable and then plugging it back in to reestablish the client/server connection.
If this doesn’t work, you can disconnect the USB cable and (stop the emulator if necessary) and close Android Studio. This is often enough to stop the adb process. Then when you open Android Studio again it will restart and the connection will be reestablished.
If this doesn’t work, you can try stopping the adb server manually using the instructions in this question. For instance, you can try opening command prompt or terminal and going to the sdk/platform-tools directory and typing:
adb kill-server
adb start-server
② A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 15280 (pool-1-thread-1), pid 15203
③Android Studio查看System.out.print的内容
debug途中System.out.print着实好用吗,参考链接:https://blog.csdn.net/jessicababy1994/article/details/86544182
④Log.v,Log.d,Log.i,Log.w,Log.e
android.util.Log常用的方法有以下5个:
- Log.v 的调试颜色为黑色的,任何消息都会输出,这里的v代表verbose啰嗦的意思,平时使用就是Log.v("","");
- Log.d的输出颜色是蓝色的,仅输出debug调试的意思,但他会输出上层的信息,过滤起来可以通过DDMS的Logcat标签来选择.
- Log.i的输出为绿色,一般提示性的消息information,它不会输出Log.v和Log.d的信息,但会显示i、w和e的信息
- Log.w的意思为橙色,可以看作为warning警告,一般需要我们注意优化Android代码,同时选择它后还会输出Log.e的信息。5. Log.e为红色,可以想到error错误,这里仅显示红色的错误信息,这些错误就需要我们认真的分析,查看栈的信息了。
注意:不同的打印方法在使用时都是某个方法带上(String tag, String msg)参数,tag表示的是打印信息的标签,msg表示的是需要打印的信息。
Log.v("----------logv",“This is Verbose.”);
Log.d("----------logd",“This is Debug.”);
Log.i("----------logt",“This is Information”);
Log.w("----------logw",“This is Warnning.”);
Log.e("----------loge",“This is Error.”);
⑤Android bug之GSEGV(SEGV_MAPERR)异常及解决
segmentation fault, 段错误
一般由a dangling pointer issue, or some sort of buffer overflow有两种SEGV,由一次无效内存访问错误引起。
1,A page was accessed which had the wrong permissions. 如某块内存区域是只读的,而程序尝试去写该块内存。SEGV_ACCERR
2,A page was accessed that is not even mapped into the address space of the application at all.
⑥Android studio下使用ndk-stack定位crash
参考:https://blog.csdn.net/a568478312/article/details/78182422