mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-20 16:57:34 +01:00
Generating public.xml file to set same resource IDs as in original apk.
This commit is contained in:
parent
a82506892d
commit
22a312f544
@ -80,6 +80,7 @@ final public class AndrolibResources {
|
||||
for (ResValuesFile valuesFile : pkg.listValuesFiles()) {
|
||||
generateValuesFile(valuesFile, out, xmlSerializer);
|
||||
}
|
||||
generatePublicXml(pkg, out, xmlSerializer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -177,6 +178,36 @@ final public class AndrolibResources {
|
||||
}
|
||||
}
|
||||
|
||||
private void generatePublicXml(ResPackage pkg, Directory out,
|
||||
XmlSerializer serial) throws AndrolibException {
|
||||
try {
|
||||
OutputStream outStream = out.getFileOutput("values/public.xml");
|
||||
serial.setOutput(outStream, null);
|
||||
serial.startDocument(null, null);
|
||||
serial.startTag(null, "resources");
|
||||
|
||||
for (ResResSpec spec : pkg.listResSpecs()) {
|
||||
serial.startTag(null, "public");
|
||||
serial.attribute(null, "type", spec.getType().getName());
|
||||
serial.attribute(null, "name", spec.getName());
|
||||
serial.attribute(null, "id", String.format(
|
||||
"0x%08x", spec.getId().id));
|
||||
serial.endTag(null, "public");
|
||||
}
|
||||
|
||||
serial.endTag(null, "resources");
|
||||
serial.endDocument();
|
||||
serial.flush();
|
||||
outStream.close();
|
||||
} catch (IOException ex) {
|
||||
throw new AndrolibException(
|
||||
"Could not generate public.xml file", ex);
|
||||
} catch (DirectoryException ex) {
|
||||
throw new AndrolibException(
|
||||
"Could not generate public.xml file", ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void loadApk(ResTable resTable, File apkFile, boolean main)
|
||||
throws AndrolibException {
|
||||
JniPackageGroup[] groups =
|
||||
|
Loading…
x
Reference in New Issue
Block a user