ste*_*002 6 java android android-studio
当我运行我的Android应用程序时,我收到以下错误:
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)
10-12 16:46:44.719 2710-2719/? E/StrictMode: at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:680)
10-12 16:46:44.719 2710-2719/? E/StrictMode: at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:388)
10-12 16:46:44.719 2710-2719/? E/StrictMode: at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:332)
10-12 16:46:44.719 2710-2719/? E/StrictMode: at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:500)
10-12 16:46:44.719 2710-2719/? E/StrictMode: at com.android.okhttp.internal.http.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105)
10-12 16:46:44.719 2710-2719/? E/StrictMode: at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:25)
10-12 16:46:44.719 2710-2719/? E/StrictMode: at com.google.android.gms.http.GoogleHttpClient.a(SourceFile:806)
10-12 16:46:44.719 2710-2719/? E/StrictMode: at com.google.android.gms.http.GoogleHttpClient.b(SourceFile:770)
10-12 16:46:44.719 2710-2719/? E/StrictMode: at com.google.android.gms.http.GoogleHttpClient.execute(SourceFile:673)
10-12 16:46:44.719 2710-2719/? E/StrictMode: at com.google.android.gms.http.GoogleHttpClient.execute(SourceFile:664)
10-12 16:46:44.719 2710-2719/? E/StrictMode: at com.google.android.gms.playlog.uploader.b.a(SourceFile:332)
10-12 16:46:44.719 2710-2719/? E/StrictMode: at com.google.android.gms.playlog.uploader.b.a(SourceFile:227)
10-12 16:46:44.719 2710-2719/? E/StrictMode: at com.google.android.gms.playlog.uploader.b.a(SourceFile:199)
10-12 16:46:44.719 2710-2719/? E/StrictMode: at com.google.android.gms.playlog.uploader.UploaderService.a(SourceFile:39)
10-12 16:46:44.719 2710-2719/? E/StrictMode: at com.google.android.gms.gcm.af.run(SourceFile:130)
Run Code Online (Sandbox Code Playgroud)
这个错误意味着什么,我该如何解决?
你能分享你的代码吗?您是否使用模拟器来运行您的应用程序或物理设备?
因为原因可能有很多:
您打开了一些东西,但从未关闭它们。Closable
有一个close()
方法,当您不再需要该组件时(例如在finally
块中),您必须调用该方法来手动释放与该组件关联的打开资源。
此外,当AndroidManifest.xml
. 例如,当<activity>
标签意外地超出<application>
模拟器StrictMode
默认打开,在真实设备上可以通过以下方式在代码中打开:
代码:
StrictMode.setVmPolicy (new StrictMode.VmPolicy.Builder().detectAll().penaltyLog()
.penaltyDeath().build());
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
9638 次 |
最近记录: |