mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-21 09:17:35 +01:00
Handles multiple package framework files correctly.
This commit is contained in:
parent
64bcb32d81
commit
68c1809a48
1
CHANGES
1
CHANGES
@ -24,6 +24,7 @@ v2.0.0 (TBA)
|
||||
-Fixed (issue #510) - Any error output is sent stderr instead of stdout
|
||||
-Fixed (issue #426) - Filename too long (JesusFreke)
|
||||
-Fixed (issue #524) - INSTALL_FAILED_DEXOPT fix (JesusFreke)
|
||||
-Fixed (issue #473) - multiple package frameworks are treated correctly.
|
||||
-Added output to list Apktool version to help debugging.
|
||||
-Updated known bytes for configurations to 38 (from addition of layout direction)
|
||||
-Fixed NPE when handling odex apks even with --no-src specified. (Thanks Rodrigo Chiossi)
|
||||
|
@ -425,13 +425,35 @@ public class ARSCDecoder {
|
||||
}
|
||||
|
||||
public ResPackage getOnePackage() throws AndrolibException {
|
||||
if (mPackages.length != 1) {
|
||||
throw new AndrolibException(
|
||||
"Arsc file contains zero or multiple packages");
|
||||
if (mPackages.length <= 0) {
|
||||
throw new AndrolibException(
|
||||
"Arsc file contains zero packages");
|
||||
} else if (mPackages.length != 1) {
|
||||
int id = findPackageWithMostResSpecs();
|
||||
LOGGER.warning("Arsc file contains multiple packages. Using package " + mPackages[id].getName() + " as default.");
|
||||
return mPackages[id];
|
||||
}
|
||||
return mPackages[0];
|
||||
}
|
||||
|
||||
public int findPackageWithMostResSpecs() {
|
||||
int count = -1;
|
||||
int id = 0;
|
||||
|
||||
// set starting point to package id 0.
|
||||
count = mPackages[0].getResSpecCount();
|
||||
|
||||
// loop through packages looking for largest
|
||||
for (int i = 0; i < mPackages.length; i++) {
|
||||
if (mPackages[i].getResSpecCount() >= count) {
|
||||
count = mPackages[i].getResSpecCount();
|
||||
id = i;
|
||||
}
|
||||
}
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
public ResTable getResTable() {
|
||||
return mResTable;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user