您如何调试Android的表面? [英] How do you debug Android's watchface?
问题描述
由于某种原因,对于您可以从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屋!