您如何调试Android的表面? [英] How do you debug Android's watchface?

查看:101
本文介绍了您如何调试Android的表面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于某种原因,对于您可以从Github的仓库中提取的表面示例,我似乎无法在Logcat中输出任何内容.我已经启用了手表模拟器中的开发功能.我有最新的Android Studio.当我开始一个全新的项目时,我可以顺利地输出到Logcat.我在做什么错了?

For some reason, I can't seem to output anything in Logcat for the watchface example that you can pull from Github's repo. I've enabled the development features in the watch emulator. I have the latest Android Studio. When I start a brand new project, I can output to Logcat without a hitch. What am I doing wrong?

推荐答案

我知道这是一个老问题,但是如果有人仍然遇到这个问题寻找答案:

I know this is an old question, but in case somebody is still coming across this looking for an answer:

我假设您是在谈论Google的表盘示例?

I assume you're talking about Googles Watchface example?

该示例使用isLoggable写入日志文件,例如:

That example uses isLoggable to write to the logfiles, for example:

    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log.d(TAG, "onConnected: " + connectionHint);
    }

您可以阅读 Log.isLoggable 的文档, isLoggable函数基本上只是自定义/优化日志消息的一种方法,默认情况下会返回false.

As you can read in the documentation for Log.isLoggable, the isLoggable function is basically just a method of customizing/optimizing your log messages, and returns false by default.

如果要启用DEBUG级别的登录,可以使用以下shell命令通过命令行执行此操作:

If you want to enable logging on DEBUG level you can do this via command line with this shell command:

adb shell setprop log.tag.NameOfMyActivity DEBUG

希望这会有所帮助.

这篇关于您如何调试Android的表面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆