10-12 16:46:44.719 2710-2719/? E/StrictMode: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
10-12 16:46:44.719 2710-2719/? E/StrictMode: java.lang.Throwable: Explicit termination method 'end' not called
10-12 16:46:44.719 2710-2719/? E/StrictMode: at dalvik.system.CloseGuard.open(CloseGuard.java:184)
10-12 16:46:44.719 2710-2719/? E/StrictMode: at java.util.zip.Inflater.
最佳答案
你能分享你的代码吗?您是否使用模拟器来运行应用程序或物理设备?
因为可能有很多原因:
>你已经打开了一些东西但从未关闭它们. Closable有一个close()方法,当你不再需要它时,你必须调用它来手动释放与组件相关的打开资源(例如在finally块中).
>此外,当AndroidManifest.xml中存在问题时,会显示该错误消息.例如,当< activity>标签意外地退出< application>
>默认情况下,仿真器启用StrictMode,在实际设备上,可以通过以下代码打开代码:
码:
StrictMode.setVmPolicy (new StrictMode.VmPolicy.Builder().detectAll().penaltyLog()
.penaltyDeath().build());