mirror of
https://github.com/revanced/Apktool.git
synced 2024-11-11 15:09:24 +01:00
Copy AndroidManifest.xml
Copy AndroidManifest.xml along with resources.arsc from the framework apk file instead of creating the fake entry.
This commit is contained in:
parent
2ec2fe817a
commit
513e4b752b
@ -624,11 +624,19 @@ final public class AndrolibResources {
|
|||||||
out.closeEntry();
|
out.closeEntry();
|
||||||
|
|
||||||
//Write fake AndroidManifest.xml file to support original aapt
|
//Write fake AndroidManifest.xml file to support original aapt
|
||||||
byte[] manifest = createAndroidManifestFileData();
|
entry = zip.getEntry("AndroidManifest.xml");
|
||||||
entry = createAndroidManifestEntry(manifest);
|
if (entry != null) {
|
||||||
out.putNextEntry(entry);
|
in = zip.getInputStream(entry);
|
||||||
out.write(manifest);
|
byte[] manifest = IOUtils.toByteArray(in);
|
||||||
out.closeEntry();
|
CRC32 manifestCrc = new CRC32();
|
||||||
|
manifestCrc.update(manifest);
|
||||||
|
entry.setSize(manifest.length);
|
||||||
|
entry.setCompressedSize(-1);
|
||||||
|
entry.setCrc(manifestCrc.getValue());
|
||||||
|
out.putNextEntry(entry);
|
||||||
|
out.write(manifest);
|
||||||
|
out.closeEntry();
|
||||||
|
}
|
||||||
|
|
||||||
zip.close();
|
zip.close();
|
||||||
LOGGER.info("Framework installed to: " + outFile);
|
LOGGER.info("Framework installed to: " + outFile);
|
||||||
@ -640,26 +648,6 @@ final public class AndrolibResources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ZipEntry createAndroidManifestEntry(byte[] data) throws IOException {
|
|
||||||
ZipEntry entry = new ZipEntry("AndroidManifest.xml");
|
|
||||||
CRC32 crc = new CRC32();
|
|
||||||
crc.update(data);
|
|
||||||
entry.setSize(data.length);
|
|
||||||
entry.setCrc(crc.getValue());
|
|
||||||
return entry;
|
|
||||||
}
|
|
||||||
|
|
||||||
private byte[] createAndroidManifestFileData() throws IOException {
|
|
||||||
File temp = File.createTempFile("AndroidManifest", ".tmp");
|
|
||||||
BufferedWriter bw = new BufferedWriter(new FileWriter(temp));
|
|
||||||
bw.write("AndroidManifest.xml for official aapt");
|
|
||||||
bw.close();
|
|
||||||
InputStream in = new FileInputStream(temp);
|
|
||||||
byte[] data = IOUtils.toByteArray(in);
|
|
||||||
in.close();
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void publicizeResources(File arscFile) throws AndrolibException {
|
public void publicizeResources(File arscFile) throws AndrolibException {
|
||||||
byte[] data = new byte[(int) arscFile.length()];
|
byte[] data = new byte[(int) arscFile.length()];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user