简体   繁体   中英

How do you debug Android's watchface?

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:

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM