Android Sample App:资源是在附加的堆栈跟踪中获取的,但从未发布过

时间:2015-08-19 18:37:55

标签: java android android-studio

我使用Android Studio模板中的一个Activity创建了一个空白的应用程序。我没有更改任何代码。在模拟器中运行应用程序时,我收到以下错误:

08-19 19:51:18.325    1645-1654/? E/StrictMode﹕ A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
    java.lang.Throwable: Explicit termination method 'end' not called
            at dalvik.system.CloseGuard.open(CloseGuard.java:184)
            at java.util.zip.Inflater.<init>(Inflater.java:82)
            at com.android.okio.GzipSource.<init>(GzipSource.java:57)
            at com.android.okhttp.internal.http.HttpEngine.initContentStream(HttpEngine.java:490)
            at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:680)
            at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:388)
            at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:332)
            at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:500)
            at com.android.okhttp.internal.http.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105)
            at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:25)
            at com.google.android.gms.http.GoogleHttpClient.a(SourceFile:806)
            at com.google.android.gms.http.GoogleHttpClient.b(SourceFile:770)
            at com.google.android.gms.http.GoogleHttpClient.execute(SourceFile:673)
            at com.google.android.gms.http.GoogleHttpClient.execute(SourceFile:664)
            at com.google.android.gms.playlog.uploader.b.a(SourceFile:332)
            at com.google.android.gms.playlog.uploader.b.a(SourceFile:227)
            at com.google.android.gms.playlog.uploader.b.a(SourceFile:199)
            at com.google.android.gms.playlog.uploader.UploaderService.a(SourceFile:39)
            at com.google.android.gms.gcm.af.run(SourceFile:130)
08-19 19:51:18.340    2581-2590/? E/StrictMode﹕ A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
    java.lang.Throwable: Explicit termination method 'close' not called
            at dalvik.system.CloseGuard.open(CloseGuard.java:184)
            at android.os.ParcelFileDescriptor.<init>(ParcelFileDescriptor.java:180)
            at android.os.ParcelFileDescriptor$1.createFromParcel(ParcelFileDescriptor.java:916)
            at android.os.ParcelFileDescriptor$1.createFromParcel(ParcelFileDescriptor.java:906)
            at android.app.IBackupAgent$Stub.onTransact(IBackupAgent.java:57)
            at android.os.Binder.execTransact(Binder.java:446)

我该如何解决?

1 个答案:

答案 0 :(得分:0)

旧版本的okhttp中存在一个已知错误,您可以通过强制在gradle文件中使用较新版本来避免此错误。     编译&#39; com.squareup.okhttp3:okhttp:3.2.0&#39; 至少为我解决了一个非常类似的问题。