mirror of
https://github.com/revanced/Apktool.git
synced 2025-05-02 06:54:25 +02:00
decoder: Extend "keep-broken-res" to also ignore duplicate resources
This commit is contained in:
parent
b29df52b87
commit
4a02f5321c
@ -73,6 +73,8 @@ public class ApkDecoder {
|
|||||||
public void decode() throws AndrolibException, IOException, DirectoryException {
|
public void decode() throws AndrolibException, IOException, DirectoryException {
|
||||||
File outDir = getOutDir();
|
File outDir = getOutDir();
|
||||||
|
|
||||||
|
AndrolibResources.sKeepBroken = mKeepBrokenResources;
|
||||||
|
|
||||||
if (!mForceDelete && outDir.exists()) {
|
if (!mForceDelete && outDir.exists()) {
|
||||||
throw new OutDirExistsException();
|
throw new OutDirExistsException();
|
||||||
}
|
}
|
||||||
@ -239,7 +241,6 @@ public class ApkDecoder {
|
|||||||
throw new AndrolibException(
|
throw new AndrolibException(
|
||||||
"Apk doesn't contain either AndroidManifest.xml file or resources.arsc file");
|
"Apk doesn't contain either AndroidManifest.xml file or resources.arsc file");
|
||||||
}
|
}
|
||||||
AndrolibResources.sKeepBroken = mKeepBrokenResources;
|
|
||||||
mResTable = mAndrolib.getResTable(mApkFile, hasResources);
|
mResTable = mAndrolib.getResTable(mApkFile, hasResources);
|
||||||
}
|
}
|
||||||
return mResTable;
|
return mResTable;
|
||||||
|
@ -249,8 +249,18 @@ public class ARSCDecoder {
|
|||||||
}
|
}
|
||||||
ResResource res = new ResResource(mType, spec, value);
|
ResResource res = new ResResource(mType, spec, value);
|
||||||
|
|
||||||
mType.addResource(res);
|
try {
|
||||||
spec.addResource(res);
|
mType.addResource(res);
|
||||||
|
spec.addResource(res);
|
||||||
|
} catch (AndrolibException e) {
|
||||||
|
if (mKeepBroken) {
|
||||||
|
mType.addResource(res, true);
|
||||||
|
spec.addResource(res, true);
|
||||||
|
System.err.println("ignoring exception: " + e);
|
||||||
|
} else {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
mPkg.addResource(res);
|
mPkg.addResource(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user