Loading Android resources from a apktool.jar file, rather than from SDK.

This commit is contained in:
Ryszard Wiśniewski 2010-03-12 16:54:45 +01:00
parent 48e1afd6b1
commit a27e1adcde

View File

@ -56,7 +56,7 @@ final public class AndrolibResources {
public ResTable getResTable(File apkFile) throws AndrolibException {
ResTable resTable = new ResTable();
loadApk(resTable, new File(getClass().getProtectionDomain().getCodeSource().getLocation().getPath()), false);
loadApk(resTable, getAndroidResourcesFile(), false);
loadApk(resTable, apkFile, true);
return resTable;
}
@ -112,7 +112,7 @@ final public class AndrolibResources {
cmd[i++] = "-F";
cmd[i++] = apkFile.getAbsolutePath();
cmd[i++] = "-I";
cmd[i++] = mAndroidJar.getAbsolutePath();
cmd[i++] = getAndroidResourcesFile().getAbsolutePath();
if (manifest != null) {
cmd[i++] = "-M";
cmd[i++] = manifest.getAbsolutePath();
@ -203,6 +203,11 @@ final public class AndrolibResources {
}
}
private File getAndroidResourcesFile() {
return new File(getClass().getProtectionDomain().getCodeSource()
.getLocation().getPath());
}
public static String escapeForResXml(String value) {
value = value.replace("'", "\\'");
value = value.replace("\n", "\\n\n");