dre*_*989 28 android android-strictmode
我在logcat中收到此消息 资源是在附加的堆栈跟踪中获取但从未发布的.有关避免资源泄漏的信息,请参阅java.io.Closeable.在哪里寻找泄漏,它是什么意思"看java.io.Closeable"
对我来说问题出现了,因为我在onBackPressed()没有调用的情况下覆盖了方法super()
@Override
public void onBackPressed() {
//some coding here
super.onBackPressed();
}
Run Code Online (Sandbox Code Playgroud)
如果你看到类似的东西:
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.<init>(Inflater.java:82)
10-12 16:46:44.719 2710-2719/? E/StrictMode: at com.android.okio.GzipSource.<init>(GzipSource.java:57)
10-12 16:46:44.719 2710-2719/? E/StrictMode: at com.android.okhttp.internal.http.HttpEngine.initContentStream(HttpEngine.java:490)
Run Code Online (Sandbox Code Playgroud)
在您的堆栈跟踪中,旧版本的okhttp中存在一个已知错误,您可以通过在gradle文件中强制使用较新版本来避免这种错误.
编译'com.squareup.okhttp3:okhttp:3.2.0'
至少为我解决了一个非常类似的问题.
| 归档时间: |
|
| 查看次数: |
34687 次 |
| 最近记录: |