Androidで解凍せずにzipファイルからファイルを削除したい。私は最初に次のコードを使用してJavaでそれを行いました
Path zipFilePath = Paths.get(filePaths); //gave the path of the zip with zip file name
try( FileSystem fs = FileSystems.newFileSystem(zipFilePath, null) ){
Path pathInZipfile = fs.getPath(reVsl3); //reVsl3 String which holds the name of the file to be deleted in the zip file
zipDelLoc=reVsl3; //just assigning it for future use
System.out.println("About to delete an entry from ZIP File" + pathInZipfile.toUri() );
// Execute Delete
Files.delete(pathInZipfile);
System.out.println("File successfully deleted");
}
catch (IOException e) {
System.out.println(e+"Error here?");
}
これは netbeans では完全に機能していますが、ADT では機能せず、logcat でエラーが発生しました
java.lang.NoClassDefFoundError: java.nio.file.Paths
で解決策を検索したところ、Android に「java.nio.file.Paths」が存在しないというヒントが得られました。zip4j を実行できる代替ソリューションを探しているか、TrueZip がここでトリックを実行します。
私はtruezipで試しましたが、このコードで
TFile archive = new TFile("archive.zip");
for (String member : archive.list())
System.out.println(member);
ただし、archive.list() は null を返しますが、archive.length は正しいファイル サイズを返します。
ここで何が間違っているのかわかりません.truezip 7.7をすべて1つのjarファイルにダウンロードしました。しかし、これを与えるとエラーが発生しますimport de.schlichtherle.io.File
助けてください