From a27e1adcde9a1ace604cff90d03a71f6b963e18d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ryszard=20Wi=C5=9Bniewski?= Date: Fri, 12 Mar 2010 16:54:45 +0100 Subject: [PATCH] Loading Android resources from a apktool.jar file, rather than from SDK. --- src/brut/androlib/res/AndrolibResources.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/brut/androlib/res/AndrolibResources.java b/src/brut/androlib/res/AndrolibResources.java index 39dfd3b2..747c1502 100644 --- a/src/brut/androlib/res/AndrolibResources.java +++ b/src/brut/androlib/res/AndrolibResources.java @@ -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");