android studio调试技巧

Debugging is the key process of finding and fixing bugs or unexpected behavior in your code. All code has errors, from incorrect behavior in your app to behavior that highly consumes memory or network...
摘要由CSDN通过智能技术生成

Debugging is the key process of finding and fixing bugs or unexpected behavior in your code. All code has errors, from incorrect behavior in your app to behavior that highly consumes memory or network resources, to actual app freezing or crashing.

调试是发现并修复代码中的错误或意外行为的关键过程。 所有代码都有错误,从应用程序中的错误行为到大量消耗内存或网络资源的行为,到实际的应用程序冻结或崩溃。

Debugging is one of the crucial parts of a software developer’s everyday life. We always attempt to write bug-free applications but to do this, we have to fix every bug, which is sometimes hard to spot in the code. Debugging allows you to go through each line of code, evaluating your app’s variables, methods and how well your code is working. It’s easier to find small mistakes in large pieces of code. In this article, we will go through important tips and tricks on debugging an Android app.

调试是软件开发人员日常生活的关键部分之一。 我们总是尝试编写无错误的应用程序,但是要做到这一点,我们必须修复每个错误,有时很难在代码中发现它们。 通过调试,您可以遍历代码的每一行,评估应用程序的变量,方法以及代码的运行状况。 在大型代码中发现小错误更容易。 在本文中,我们将介绍调试Android应用程序的重要提示和技巧。

  1. Log filtering/folding

    日志过滤/折叠

  2. Conditional breakpoints

    条件断点

  3. Dependent breakpoints

    相关断点

  4. Suspend thread

    挂起线程

  5. Evaluate and log

    评估并记录

  6. Breakpoint groups

    断点组

  7. Drop frame

    落架

  8. Evaluate expression

    评估表达

  9. Apply changes

    应用更改

  10. Analyze stack trace

    分析堆栈跟踪

Log filtering / folding

日志过滤/折叠

If we open up Logcat in Android Studio, we are seeing these things on that Logcat surfaces.

如果我们在Android Studio中打开Logcat ,则会在Logcat表面上看到这些东西。

Image for post

Show date and time with seconds: 1517955388.555 123–456, process and thread IDs: SampleTag, package name: com.android.sample and show tag: This is a sample message

显示日期和时间与秒:1517955388.555 123-456,进程和线程ID:SampleTag,包名:com.android.sample和显示标签:这是一个示例消息

In most cases, we don’t need date and time, package name and thread IDs. So to do that we can uncheck these options and we can view what are necessary.

在大多数情况下,我们不需要日期和时间,程序包名称和线程ID。 因此,我们可以取消选中这些选项,然后查看所需的内容。

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值