W/System: A resource failed to call release

后端 未结 3 3926
甜味超标
甜味超标 2020-12-11 03:00

As the title says. When using the console of AndroidStudio on my app it shows:

W/System: A resource failed to call release.

Sometimes it is said multiple ti

3条回答
  •  [愿得一人]
    2020-12-11 03:15

    This message comes from dalvik.system.CloseGuard. When debugging, you can set it up to create stack traces as you create resources, so that you can track down what objects aren't being closed.

    It's not part of the framework API, so I'm using reflection to turn that on:

    try {
        Class.forName("dalvik.system.CloseGuard")
                .getMethod("setEnabled", boolean.class)
                .invoke(null, true);
    } catch (ReflectiveOperationException e) {
        throw new RuntimeException(e);
    }
    

    more info: https://wh0.github.io/2020/08/12/closeguard.html

提交回复
热议问题