mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-08 11:05:52 +01:00
fix: patch aapt2 to not run custom commands on passed aapt2 binary
This commit is contained in:
parent
d6f38e38cd
commit
b05f19b80d
@ -341,7 +341,7 @@ final public class AndrolibResources {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void aapt2Package(File apkFile, File manifest, File resDir, File rawDir, File assetDir, File[] include,
|
private void aapt2Package(File apkFile, File manifest, File resDir, File rawDir, File assetDir, File[] include,
|
||||||
List<String> cmd)
|
List<String> cmd, boolean customAapt)
|
||||||
throws AndrolibException {
|
throws AndrolibException {
|
||||||
|
|
||||||
List<String> compileCommand = new ArrayList<>(cmd);
|
List<String> compileCommand = new ArrayList<>(cmd);
|
||||||
@ -448,10 +448,17 @@ final public class AndrolibResources {
|
|||||||
cmd.add("-x");
|
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();
|
String extensionsFilePath = createDoNotCompressExtensionsFile(apkOptions).getAbsolutePath();
|
||||||
cmd.add("-e");
|
cmd.add("-e");
|
||||||
cmd.add(extensionsFilePath);
|
cmd.add(extensionsFilePath);
|
||||||
|
} else if (apkOptions.doNotCompress != null) {
|
||||||
|
for (String file : apkOptions.doNotCompress) {
|
||||||
|
cmd.add("-0");
|
||||||
|
cmd.add(file);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!apkOptions.resourcesAreCompressed) {
|
if (!apkOptions.resourcesAreCompressed) {
|
||||||
@ -627,7 +634,7 @@ final public class AndrolibResources {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (apkOptions.isAapt2()) {
|
if (apkOptions.isAapt2()) {
|
||||||
aapt2Package(apkFile, manifest, resDir, rawDir, assetDir, include, cmd);
|
aapt2Package(apkFile, manifest, resDir, rawDir, assetDir, include, cmd, customAapt);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
aapt1Package(apkFile, manifest, resDir, rawDir, assetDir, include, cmd, customAapt);
|
aapt1Package(apkFile, manifest, resDir, rawDir, assetDir, include, cmd, customAapt);
|
||||||
|
Loading…
Reference in New Issue
Block a user