Only attempt to use -e option when the packaged aapt binary is used.
@@ -563,10 +563,17 @@ final public class AndrolibResources {
cmd.add("-x");
}
- if (apkOptions.doNotCompress != null) {
+ if (apkOptions.doNotCompress != null && !customAapt) {
+ // Use custom -e option to avoid limits on commandline length.
+ // Can only be used when custom aapt binary is not used.
String extensionsFilePath = createDoNotCompressExtensionsFile(apkOptions).getAbsolutePath();
cmd.add("-e");
cmd.add(extensionsFilePath);
+ } else if (apkOptions.doNotCompress != null) {
+ for (String file : apkOptions.doNotCompress) {
+ cmd.add("-0");
+ cmd.add(file);
+ }
}
if (!apkOptions.resourcesAreCompressed) {
