A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks

后端 未结 6 1798
心在旅途
心在旅途 2020-11-29 11:18

i am getting this message in logcat A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource l

6条回答
  •  南笙
    南笙 (楼主)
    2020-11-29 11:43

    My error was caused by enabling the strict mode. When I was doing redeployments on a test phone using adb, some resources were not closed correctly.

    I "fixed" the error by removing deathPenalty from the strict mode:

                StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
                        .detectAll()
                        .penaltyLog()
    //                    .penaltyDeath()
                        .build());
    

提交回复
热议问题