mirror of
https://github.com/revanced/Apktool.git
synced 2024-12-11 21:37:47 +01:00
fix: allow detection of aapt2 from old SDK builds
This commit is contained in:
parent
684e96a4fe
commit
3a33bfc48f
@ -82,6 +82,18 @@ public class AaptManager {
|
||||
return "aapt" + (version == 2 ? "2" : "");
|
||||
}
|
||||
|
||||
public static int getAppVersionFromString(String version) throws BrutException {
|
||||
if (version.startsWith("Android Asset Packaging Tool (aapt) 2:")) {
|
||||
return 2;
|
||||
} else if (version.startsWith("Android Asset Packaging Tool (aapt) 2.")) {
|
||||
return 2; // Prior to Android SDK 26.0.2
|
||||
} else if (version.startsWith("Android Asset Packaging Tool, v0.")) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
throw new BrutException("aapt version could not be identified: " + version);
|
||||
}
|
||||
|
||||
public static int getApptVersion(File aapt) throws BrutException {
|
||||
if (!aapt.isFile()) {
|
||||
throw new BrutException("Could not identify aapt binary as executable.");
|
||||
@ -98,12 +110,6 @@ public class AaptManager {
|
||||
throw new BrutException("Could not execute aapt binary at location: " + aapt.getAbsolutePath());
|
||||
}
|
||||
|
||||
if (version.startsWith("Android Asset Packaging Tool (aapt) 2:")) {
|
||||
return 2;
|
||||
} else if (version.startsWith("Android Asset Packaging Tool, v0.")) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
throw new BrutException("aapt version could not be identified: " + version);
|
||||
return getAppVersionFromString(version);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user