Issue
Since update AS 1.1 Preview 2, I'm getting red lines under all my Log
messages
Log.d(TAG, "message");
With message: "The logging tag can be at most 23 characters..".
I didn't update anything fundamentally, except Android Studio itself. Is this a bug?
Solution
No, it's not a bug.
From Android Studio's Recent Changes on 1.1 Preview 2,
Checks that the tag passed to the logging calls, if its value can be resolved, is at most 23 characters long (as required by the Logging API.)
As shortly explained on the recent changes, it's due to how Log
API doesn't allow tag that exceeds 23 characters.
SLF4J Android has an explanation to this:
[...] the length of such tags is currently limited to 23 characters (23 = 32 - 8 for namespace prefix - 1 for C terminator)
which matches the Android's source code.
Currently, the only function that explicitly mentions this exception is Log.isLoggable()
,
...
Throws
IllegalArgumentException is thrown if the tag.length() > 23.
However, based on the comments, apparently the logger does throw the exception on release mode (it's ignored in debug mode).
You can disable the lint checking by following Terence's answer, but you've been warned.
Answered By - Andrew T.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.