azhon / AppUpdate

Android App update library. Android版本更新库,简单、轻量、可随意定制
Apache License 2.0
2.32k stars 338 forks source link

BUG java.io.IOException #103

Closed jalena closed 3 years ago

jalena commented 3 years ago

Bug标题 okhttp有个异常~

AppUpdate参数设置 截图DownloadManager配置

private void update(AppVersionInfoEntity appVersion) {
        UpdateConfiguration configuration = new UpdateConfiguration()
                .setEnableLog(BuildConfig.DEBUG)
                .setJumpInstallPage(true)
                .setShowNotification(true)
                .setShowBgdToast(true)
                .setOnDownloadListener(this)
                .setDialogProgressBarColor(R.color.red_primary)
                .setForcedUpgrade(appVersion.getUpdateStatus() == 2);

        DownloadManager manager = DownloadManager.getInstance(this);
        manager.setApkName(String.format("%s.apk", appVersion.getVersionCode()))
               .setApkUrl(appVersion.getDownloadUrl())
               .setSmallIcon(R.mipmap.ic_launcher)
               .setShowNewerToast(true)
               .setConfiguration(configuration)
               .setApkVersionCode(appVersion.getVersionCode())
               .setApkVersionName(appVersion.getVersionName())
               .setApkSize(String.valueOf(appVersion.getApkSize()))
               .setApkDescription(appVersion.getModifyContent())
               .setApkMD5(appVersion.getApkMd5())
               .download();
    }

复现步骤 正常启动,提示的错误,程序能继续运行。

错误Logcat日志截图

E/AppUpdate.DownloadManager: 当前已是最新版本
I/Choreographer: Skipped 2006 frames!  The application may be doing too much work on its main thread.
W/System.err: java.io.IOException: unexpected end of stream on com.android.okhttp.Address@cd03a12d
W/System.err:     at com.android.okhttp.internal.http.Http1xStream.readResponse(Http1xStream.java:203)
W/System.err:     at com.android.okhttp.internal.http.Http1xStream.readResponseHeaders(Http1xStream.java:129)
W/System.err:     at com.android.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:750)
W/System.err:     at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:622)
W/System.err:     at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:475)
W/System.err:     at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:411)
W/System.err:     at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:542)
W/System.err:     at com.azhon.appupdate.utils.HttpUtil$1.run(HttpUtil.java:89)
W/System.err:     at java.lang.Thread.run(Thread.java:919)
W/System.err: Caused by: java.io.EOFException: \n not found: size=0 content=...
        at com.android.okhttp.okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:202)
W/System.err:     at com.android.okhttp.internal.http.Http1xStream.readResponse(Http1xStream.java:188)
W/System.err:   ... 8 more

软件版本信息

额外有用的信息 补充额外有用的信息

azhon commented 3 years ago

这个没关系的,后期将HttpUtil类移除