How do you debug Android's watchface?

混江龙づ霸主 提交于 2019-12-25 16:30:12

问题


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?


回答1:


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

I assume you're talking about Googles Watchface example?

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

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

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.

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

Hope this helps.



来源:https://stackoverflow.com/questions/27825958/how-do-you-debug-androids-watchface

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!