mirror of
https://github.com/revanced/Apktool.git
synced 2024-12-12 13:57:46 +01:00
fixed install|if frameworks with commons-compress
This commit is contained in:
parent
9e50300ec2
commit
47a5eac0b0
@ -553,6 +553,7 @@ public class Androlib {
|
||||
// might need to use Zip4j
|
||||
}
|
||||
}
|
||||
apkZipFile.close();
|
||||
} catch (IOException ex) {
|
||||
throw new AndrolibException(ex);
|
||||
}
|
||||
|
@ -44,6 +44,8 @@ import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
|
||||
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
|
||||
import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
@ -687,10 +689,10 @@ final public class AndrolibResources {
|
||||
public void installFramework(File frameFile, String tag)
|
||||
throws AndrolibException {
|
||||
InputStream in = null;
|
||||
ZipOutputStream out = null;
|
||||
ZipArchiveOutputStream out = null;
|
||||
try {
|
||||
ZipFile zip = new ZipFile(frameFile);
|
||||
ZipEntry entry = zip.getEntry("resources.arsc");
|
||||
ZipExtFile zip = new ZipExtFile(frameFile);
|
||||
ZipArchiveEntry entry = zip.getEntry("resources.arsc");
|
||||
|
||||
if (entry == null) {
|
||||
throw new AndrolibException("Can't find resources.arsc file");
|
||||
@ -708,15 +710,19 @@ final public class AndrolibResources {
|
||||
+ (tag == null ? "" : '-' + tag)
|
||||
+ ".apk");
|
||||
|
||||
out = new ZipOutputStream(new FileOutputStream(outFile));
|
||||
out = new ZipArchiveOutputStream(new FileOutputStream(outFile));
|
||||
out.setMethod(ZipOutputStream.STORED);
|
||||
|
||||
CRC32 crc = new CRC32();
|
||||
crc.update(data);
|
||||
entry = new ZipEntry("resources.arsc");
|
||||
entry = new ZipArchiveEntry("resources.arsc");
|
||||
entry.setSize(data.length);
|
||||
entry.setCrc(crc.getValue());
|
||||
out.putNextEntry(entry);
|
||||
out.putArchiveEntry(entry);
|
||||
out.write(data);
|
||||
|
||||
out.closeArchiveEntry();
|
||||
zip.close();
|
||||
LOGGER.info("Framework installed to: " + outFile);
|
||||
} catch (ZipException ex) {
|
||||
throw new AndrolibException(ex);
|
||||
|
Loading…
Reference in New Issue
Block a user