【问题标题】:the logt abbreviation not work in AndroidStudio live templatesloft 缩写在 Android Studio 实时模板中不起作用
【发布时间】:2021-12-21 01:29:54
【问题描述】:

在 AndroidStudio 实时模板中,logt 缩写不起作用,但 logd 或 logm 有效。 输入logt时生成private static final String TAG = "Cannot invoke method length() on null object";,其表达式为"groovyScript("_1.take(Math.min(23, _1.length()));", 类名())"。好像注意到是错误的,但是logt结果是错误的。

Android Studio 北极狐 | 2020.3.1 补丁 3 macOS 11.4

【问题讨论】:

    标签: android android-studio live-templates


    【解决方案1】:

    和我一样,好像是groovy中的className()引起的,

    这是我的临时解决方案:

    替换为 fileNameWithoutExtension()。

    这里:

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

    【讨论】:

    • 是的,这也是我的临时解决方案,但在内部类中不起作用。
    猜你喜欢
    • 1970-01-01
    • 2015-02-04
    • 2019-05-13
    • 2014-06-09
    • 2017-05-26
    • 1970-01-01
    • 2017-08-18
    • 1970-01-01
    • 2016-12-24
    相关资源
    最近更新 更多