mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-07 10:35:52 +01:00
added --verbose option to output response from aapt. Used for debugging
This commit is contained in:
parent
5a056e3f9c
commit
617437a5cc
@ -152,6 +152,7 @@ public class Main {
|
|||||||
AndrolibException {
|
AndrolibException {
|
||||||
boolean forceBuildAll = false;
|
boolean forceBuildAll = false;
|
||||||
boolean debug = false;
|
boolean debug = false;
|
||||||
|
boolean verbose = false;
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < args.length; i++) {
|
for (i = 0; i < args.length; i++) {
|
||||||
String opt = args[i];
|
String opt = args[i];
|
||||||
@ -162,6 +163,8 @@ public class Main {
|
|||||||
forceBuildAll = true;
|
forceBuildAll = true;
|
||||||
} else if ("-d".equals(opt) || "--debug".equals(opt)) {
|
} else if ("-d".equals(opt) || "--debug".equals(opt)) {
|
||||||
debug = true;
|
debug = true;
|
||||||
|
} else if ("-v".equals(opt) || "--verbose".equals(opt)) {
|
||||||
|
verbose = true;
|
||||||
} else {
|
} else {
|
||||||
throw new InvalidArgsError();
|
throw new InvalidArgsError();
|
||||||
}
|
}
|
||||||
@ -183,7 +186,7 @@ public class Main {
|
|||||||
}
|
}
|
||||||
|
|
||||||
new Androlib().build(new File(appDirName), outFile, forceBuildAll,
|
new Androlib().build(new File(appDirName), outFile, forceBuildAll,
|
||||||
debug);
|
debug, verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void cmdInstallFramework(String[] args)
|
private static void cmdInstallFramework(String[] args)
|
||||||
|
@ -170,12 +170,12 @@ public class Androlib {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void build(File appDir, File outFile, boolean forceBuildAll,
|
public void build(File appDir, File outFile, boolean forceBuildAll,
|
||||||
boolean debug) throws AndrolibException {
|
boolean debug, boolean verbose) throws AndrolibException {
|
||||||
build(new ExtFile(appDir), outFile, forceBuildAll, debug);
|
build(new ExtFile(appDir), outFile, forceBuildAll, debug, verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void build(ExtFile appDir, File outFile, boolean forceBuildAll,
|
public void build(ExtFile appDir, File outFile, boolean forceBuildAll,
|
||||||
boolean debug) throws AndrolibException {
|
boolean debug, boolean verbose) throws AndrolibException {
|
||||||
Map<String, Object> meta = readMetaFile(appDir);
|
Map<String, Object> meta = readMetaFile(appDir);
|
||||||
Object t1 = meta.get("isFrameworkApk");
|
Object t1 = meta.get("isFrameworkApk");
|
||||||
boolean framework = t1 == null ? false : (Boolean) t1;
|
boolean framework = t1 == null ? false : (Boolean) t1;
|
||||||
@ -192,7 +192,7 @@ public class Androlib {
|
|||||||
buildResources(appDir, forceBuildAll, framework,
|
buildResources(appDir, forceBuildAll, framework,
|
||||||
(Map<String, Object>) meta.get("usesFramework"));
|
(Map<String, Object>) meta.get("usesFramework"));
|
||||||
buildLib(appDir, forceBuildAll);
|
buildLib(appDir, forceBuildAll);
|
||||||
buildApk(appDir, outFile, framework);
|
buildApk(appDir, outFile, framework, verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void buildSources(File appDir, boolean forceBuildAll, boolean debug)
|
public void buildSources(File appDir, boolean forceBuildAll, boolean debug)
|
||||||
@ -326,7 +326,7 @@ public class Androlib {
|
|||||||
new File(appDir, "AndroidManifest.xml"),
|
new File(appDir, "AndroidManifest.xml"),
|
||||||
new File(appDir, "res"),
|
new File(appDir, "res"),
|
||||||
ninePatch, null, parseUsesFramework(usesFramework),
|
ninePatch, null, parseUsesFramework(usesFramework),
|
||||||
false, framework
|
false, framework, false
|
||||||
);
|
);
|
||||||
|
|
||||||
Directory tmpDir = new ExtFile(apkFile).getDirectory();
|
Directory tmpDir = new ExtFile(apkFile).getDirectory();
|
||||||
@ -384,7 +384,7 @@ public class Androlib {
|
|||||||
new File(appDir, "AndroidManifest.xml"),
|
new File(appDir, "AndroidManifest.xml"),
|
||||||
null,
|
null,
|
||||||
ninePatch, null, parseUsesFramework(usesFramework),
|
ninePatch, null, parseUsesFramework(usesFramework),
|
||||||
false, framework
|
false, framework, false
|
||||||
);
|
);
|
||||||
|
|
||||||
Directory tmpDir = new ExtFile(apkFile).getDirectory();
|
Directory tmpDir = new ExtFile(apkFile).getDirectory();
|
||||||
@ -419,7 +419,7 @@ public class Androlib {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void buildApk(File appDir, File outApk, boolean framework)
|
public void buildApk(File appDir, File outApk, boolean framework, boolean verbose)
|
||||||
throws AndrolibException {
|
throws AndrolibException {
|
||||||
LOGGER.info("Building apk file...");
|
LOGGER.info("Building apk file...");
|
||||||
if (outApk.exists()) {
|
if (outApk.exists()) {
|
||||||
@ -435,7 +435,7 @@ public class Androlib {
|
|||||||
assetDir = null;
|
assetDir = null;
|
||||||
}
|
}
|
||||||
mAndRes.aaptPackage(outApk, null, null,
|
mAndRes.aaptPackage(outApk, null, null,
|
||||||
new File(appDir, APK_DIRNAME), assetDir, null, false, framework);
|
new File(appDir, APK_DIRNAME), assetDir, null, false, framework, verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void publicizeResources(File arscFile) throws AndrolibException {
|
public void publicizeResources(File arscFile) throws AndrolibException {
|
||||||
|
@ -193,12 +193,15 @@ final public class AndrolibResources {
|
|||||||
|
|
||||||
public void aaptPackage(File apkFile, File manifest, File resDir,
|
public void aaptPackage(File apkFile, File manifest, File resDir,
|
||||||
File rawDir, File assetDir, File[] include,
|
File rawDir, File assetDir, File[] include,
|
||||||
boolean update, boolean framework) throws AndrolibException {
|
boolean update, boolean framework, boolean verbose) throws AndrolibException {
|
||||||
List<String> cmd = new ArrayList<String>();
|
List<String> cmd = new ArrayList<String>();
|
||||||
|
|
||||||
cmd.add("aapt");
|
cmd.add("aapt");
|
||||||
cmd.add("p");
|
cmd.add("p");
|
||||||
cmd.add("-v"); //mega debug mode.@todo REMOVE ON FINAL
|
|
||||||
|
if (verbose) {
|
||||||
|
cmd.add("-v");
|
||||||
|
}
|
||||||
|
|
||||||
if (update) {
|
if (update) {
|
||||||
cmd.add("-u");
|
cmd.add("-u");
|
||||||
|
@ -44,7 +44,7 @@ public class BuildAndDecodeTest {
|
|||||||
"brut/apktool/testapp/", sTestOrigDir);
|
"brut/apktool/testapp/", sTestOrigDir);
|
||||||
|
|
||||||
LOGGER.info("Building testapp.apk...");
|
LOGGER.info("Building testapp.apk...");
|
||||||
new Androlib().build(sTestOrigDir, testApk, false, false);
|
new Androlib().build(sTestOrigDir, testApk, false, false, false);
|
||||||
|
|
||||||
LOGGER.info("Decoding testapp.apk...");
|
LOGGER.info("Decoding testapp.apk...");
|
||||||
ApkDecoder apkDecoder = new ApkDecoder(testApk);
|
ApkDecoder apkDecoder = new ApkDecoder(testApk);
|
||||||
|
Loading…
Reference in New Issue
Block a user