用apache的ant.jar在安卓上解zip压缩,pc运行没问题,但安卓上就报错,请帮忙! PC运行正常,安卓运行就报错,请各位帮忙。 源码: public static void unzip2(String sourceZip,String destDir) throws Exception{ try{ Project p = new Project(); Expand e = new Expand(); e.setProject(p); e.setSrc(new File(sourceZip)); e.setOverwrite(false); e.setDest(new File(destDir)); e.setEncoding("UTF-8"); //根据linux系统的实际编码设置 e.execute(); }catch(Exception e){ throw e; } }
报错如下:
GC freed 640 objects / 50336 bytes in 38ms Could not find class 'org.apache.tools.ant.Project', referenced from method cn.cmmb.zip2.Decompression.unzip2 VFY: unable to resolve new-instance 93 (Lorg/apache/tools/ant/Project;) in Lcn/cmmb/zip2/Decompression; VFY: replacing opcode 0x22 at 0x0000 Making a copy of Lcn/cmmb/zip2/Decompression;.unzip2 code (116 bytes) VFY: unable to find class referenced in signature (Lorg/apache/tools/zip/ZipOutputStream;) Could not find class 'org.apache.tools.zip.ZipEntry', referenced from method cn.cmmb.zip2.Decompression.zip VFY: unable to resolve new-instance 95 (Lorg/apache/tools/zip/ZipEntry;) in Lcn/cmmb/zip2/Decompression; VFY: replacing opcode 0x22 at 0x000b Making a copy of Lcn/cmmb/zip2/Decompression;.zip code (425 bytes) Could not find class 'org.apache.tools.zip.ZipEntry', referenced from method cn.cmmb.zip2.Decompression.zip VFY: unable to resolve new-instance 95 (Lorg/apache/tools/zip/ZipEntry;) in Lcn/cmmb/zip2/Decompression; VFY: replacing opcode 0x22 at 0x006d Could not find class 'org.apache.tools.zip.ZipEntry', referenced from method cn.cmmb.zip2.Decompression.zip VFY: unable to resolve new-instance 95 (Lorg/apache/tools/zip/ZipEntry;) in Lcn/cmmb/zip2/Decompression; VFY: replacing opcode 0x22 at 0x008c Could not find class 'org.apache.tools.zip.ZipFile', referenced from method cn.cmmb.zip2.Decompression.unzip VFY: unable to resolve new-instance 96 (Lorg/apache/tools/zip/ZipFile;) in Lcn/cmmb/zip2/Decompression; VFY: replacing opcode 0x22 at 0x0014 Making a copy of Lcn/cmmb/zip2/Decompression;.unzip code (635 bytes) Could not find class 'org.apache.tools.zip.ZipFile', referenced from method cn.cmmb.zip2.Decompression.unzip VFY: unable to resolve new-instance 96 (Lorg/apache/tools/zip/ZipFile;) in Lcn/cmmb/zip2/Decompression; VFY: replacing opcode 0x22 at 0x0014 Making a copy of Lcn/cmmb/zip2/Decompression;.unzip code (635 bytes) Could not find class 'org.apache.tools.zip.ZipOutputStream', referenced from method cn.cmmb.zip2.Decompression.zip VFY: unable to resolve new-instance 97 (Lorg/apache/tools/zip/ZipOutputStream;) in Lcn/cmmb/zip2/Decompression; VFY: replacing opcode 0x22 at 0x0001 Making a copy of Lcn/cmmb/zip2/Decompression;.zip code (137 bytes) Shutting down VM