Blankj / AndroidUtilCode

:fire: Android developers should collect the following utils(updating).
https://blankj.com/2016/07/31/android-utils-code/
Apache License 2.0
33.23k stars 10.67k forks source link

ZipUtil Exception #515

Closed wying111 closed 6 years ago

wying111 commented 6 years ago

End Of Central Directory signature not found

Blankj commented 6 years ago

wying111 commented 6 years ago

解压的时候报这个错 @Blankj

Blankj commented 6 years ago

压缩是用的我工具类吗

wying111 commented 6 years ago

是啊

Blankj commented 6 years ago

每次都会异常? 我看你调用的代码

wying111 commented 6 years ago
private void zipFiles(DownloadTask task) {
        File file = task.getFile();
        String ext = file.getAbsolutePath().substring(file.getAbsolutePath().lastIndexOf("."));
        if (ext.contains("zip")){
            try {
                ZipUtils.unzipFile(file,file.getParentFile());
            }catch (Exception e){
                QLog.e(e.toString());
            }
        }
    }
wying111 commented 6 years ago

java.util.zip.ZipException: End Of Central Directory signature not found

Blankj commented 6 years ago

搜索出来的结果是文件还没下载完你就开始解压了,你等文件下载完再解压试试

wying111 commented 6 years ago

行,我试试^ ^

Blankj commented 6 years ago

你 zip 文件大小是多少 超过 2G 了吗

wying111 commented 6 years ago

不到5m,还是报错

wying111 commented 6 years ago

我延时5s解压还是有问题

Blankj commented 6 years ago

那你把 zip 包拿出来手动解压呢

wying111 commented 6 years ago

可以啊,我pull出来是可以的

Blankj commented 6 years ago

那你把可以的包放到固定路径下,用我工具类试试

Blankj commented 6 years ago

或者你先发给我,我来试下

wying111 commented 6 years ago

我先试下,您先忙着

wying111 commented 6 years ago

老哥,搞明白了,是我用的流利说下载框架配置有问题,之前下载的都可以,这个类没问题,可以解压