mirror of
https://github.com/revanced/Apktool.git
synced 2025-05-02 06:54:25 +02: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());
|
entry.setCrc(crc.getValue());
|
||||||
out.putNextEntry(entry);
|
out.putNextEntry(entry);
|
||||||
out.write(data);
|
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();
|
zip.close();
|
||||||
LOGGER.info("Framework installed to: " + outFile);
|
LOGGER.info("Framework installed to: " + outFile);
|
||||||
} catch (IOException ex) {
|
} 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 {
|
public void publicizeResources(File arscFile) throws AndrolibException {
|
||||||
byte[] data = new byte[(int) arscFile.length()];
|
byte[] data = new byte[(int) arscFile.length()];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user