feat: Expose the aapt --no-crunch option

- Add a --no-crunch/-nc flag to apktool which gets passed through to aapt
- This allows apktool to make a byte-for-byte copy of resource files
- refs: #1232
This commit is contained in:
Seb Patane
2018-07-24 13:54:37 +10:00
parent 6231edfcfd
commit b0fd764df4
3 changed files with 18 additions and 0 deletions

View File

@ -28,6 +28,7 @@ public class ApkOptions {
public boolean isFramework = false;
public boolean resourcesAreCompressed = false;
public boolean useAapt2 = false;
public boolean noCrunch = false;
public Collection<String> doNotCompress;
public String frameworkFolderLocation = null;

View File

@ -350,6 +350,10 @@ final public class AndrolibResources {
cmd.add("-v");
}
if (apkOptions.noCrunch) {
cmd.add("--no-crunch");
}
try {
OS.exec(cmd.toArray(new String[0]));
LOGGER.fine("aapt2 compile command ran: ");
@ -485,6 +489,9 @@ final public class AndrolibResources {
if (apkOptions.debugMode) { // inject debuggable="true" into manifest
cmd.add("--debug-mode");
}
if (apkOptions.noCrunch) {
cmd.add("--no-crunch");
}
// force package id so that some frameworks build with correct id
// disable if user adds own aapt (can't know if they have this feature)
if (mPackageId != null && ! customAapt && ! mSharedLibrary) {