mirror of
https://github.com/revanced/Apktool.git
synced 2024-09-05 05:55:29 +02: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();
|
||||
|
||||
//Write fake AndroidManifest.xml file to support original aapt
|
||||
byte[] manifest = createAndroidManifestFileData();
|
||||
entry = createAndroidManifestEntry(manifest);
|
||||
entry = zip.getEntry("AndroidManifest.xml");
|
||||
if (entry != null) {
|
||||
in = zip.getInputStream(entry);
|
||||
byte[] manifest = IOUtils.toByteArray(in);
|
||||
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();
|
||||
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 {
|
||||
byte[] data = new byte[(int) arscFile.length()];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user