android studio debug记录

①E/ART: Failed sending reply to debugger: Broken pipe.

参考链接:https://stackoverflow.com/questions/31436157/e-art-failed-sending-reply-to-debugger-broken-pipe-but-application-still-runs

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

参考链接:https://stackoverflow.com/questions/17840521/android-fatal-signal-11-sigsegv-at-0x636f7d89-code-1-how-can-it-be-tracked/33678476

③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个:

  1. Log.v 的调试颜色为黑色的,任何消息都会输出,这里的v代表verbose啰嗦的意思,平时使用就是Log.v("","");
  2. Log.d的输出颜色是蓝色的,仅输出debug调试的意思,但他会输出上层的信息,过滤起来可以通过DDMS的Logcat标签来选择.
  3. Log.i的输出为绿色,一般提示性的消息information,它不会输出Log.v和Log.d的信息,但会显示i、w和e的信息
  4. 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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值