mirror of
https://github.com/revanced/Apktool.git
synced 2024-11-11 06:59:24 +01:00
Support of official aapt
Create fake AndroidManifest.xml file inside each installed framework file to support official aapt from Google.
This commit is contained in:
parent
639ac84edb
commit
6e065f15a0
@ -621,6 +621,15 @@ final public class AndrolibResources {
|
||||
entry.setCrc(crc.getValue());
|
||||
out.putNextEntry(entry);
|
||||
out.write(data);
|
||||
out.closeEntry();
|
||||
|
||||
//Write fake AndroidManifest.xml file to support original aapt
|
||||
byte[] manifest = createAndroidManifestFileData();
|
||||
entry = createAndroidManifestEntry(manifest);
|
||||
out.putNextEntry(entry);
|
||||
out.write(data);
|
||||
out.closeEntry();
|
||||
|
||||
zip.close();
|
||||
LOGGER.info("Framework installed to: " + outFile);
|
||||
} catch (IOException ex) {
|
||||
@ -631,6 +640,26 @@ 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