my current android application regularly reports this logcat message
W/System: A resource failed to call close.
having searched for how to identify the root cause i have tried the following approaches, none of which have worked...
StrictMode.setVmPolicy(
VmPolicy.Builder()
.detectLeakedClosableObjects()
.penaltyDeath()
.build()
)
and this
StrictMode.setVmPolicy(
VmPolicy.Builder()
.detectAll()
.penaltyDeath()
.build()
)
and
try {
Class.forName("dalvik.system.CloseGuard")
.getMethod("setEnabled", Boolean::class.javaPrimitiveType)
.invoke(null, true)
} catch (e: ReflectiveOperationException) {
throw java.lang.RuntimeException(e)
}
my application targets these versions of android
compileSdkVersion 32
buildToolsVersion "32.0.0"
defaultConfig {
applicationId "com.my.app"
minSdkVersion 26
targetSdkVersion 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
where am i going wrong?
how can i discover which resource is not calling close?