the logt abbreviation not work in AndroidStudio live templates

Viewed 100

The logt abbreviation not work, but logd or logm works, in AndroidStudio live templates. When input logt, it generates private static final String TAG = "Cannot invoke method length() on null object";, and its expression is "groovyScript("_1.take(Math.min(23, _1.length()));", className())". It seems noting is wrong, but the logt result is wrong.

Android Studio Arctic Fox | 2020.3.1 Patch 3 macOS 11.4

1 Answers

Like me, it seems to be caused by className() in groovy,

This is my temporary solution:

Replace with fileNameWithoutExtension().

Here:

groovyScript("_1.take(Math.min(23, _1.length()));", fileNameWithoutExtension())
Related