search

Home  >  Q&A  >  body text

android - 安卓APP下载apk,进度卡在100%不完成

我是个不会写代码的产品经理

手头有一个项目,类似应用商店,有一个下载管理模块,功能是下载、升级、卸载。

我能描述的基本信息如下:

  1. 个线程下载
  2. 启动下载时候特别慢,即是0-1%的时间很长,不确定是否是建立连接的时间长,这个还可以忍
  3. 资源放在CDN上,服务器资源不是问题,所以下载速度很好,只是在100%时会卡时间很长。下载直接写在内置的存储上,没有外置SD卡,也没有使用写入内存,然后在写入SD卡的方案

诸位在安卓开发中有没有遇到过类似的问题?

伊谢尔伦伊谢尔伦2772 days ago610

reply all(1)I'll reply

  • 迷茫

    迷茫2017-04-17 11:36:55

    1. Log the time before and after connect to see how long the connection takes.
    2. The download may be slightly slower at the beginning because it involves file creation (this time is very short).
    3. Check the content-length returned by http and compare it with the length of your inputstream read to see if the reception is completed.
    4. Check whether inputstream read has been packaged by itself and whether it affects efficiency.
    5. Downloads are written directly to the memory card (built-in memory card, or SD card). If you write to the memory and then copy to the memory card, the memory will explode.

    reply
    0
  • Cancelreply