mirror of
https://github.com/revanced/Apktool.git
synced 2024-12-11 21:37:47 +01:00
fix: pass opcodes=null for baksmali to auto-determine by dex version
When DexBackedDexFile gets opcodes==null, it calls getDefaultOpcodes(dexVersion) which returns the appropriate opcodes for the given dex version. No hints are required for baksmali, but only needed for smali. https://github.com/JesusFreke/smali/blob/master/dexlib2/src/main/java/org/jf/dexlib2/dexbacked/DexBackedDexFile.java#L83
This commit is contained in:
parent
204b742cf0
commit
1472b50541
@ -71,10 +71,6 @@ public class ApkDecoder {
|
||||
mOutDir = outDir;
|
||||
}
|
||||
|
||||
public void setApiLevel(int apiLevel) {
|
||||
mApiLevel = apiLevel;
|
||||
}
|
||||
|
||||
public void decode() throws AndrolibException, IOException, DirectoryException {
|
||||
try {
|
||||
File outDir = getOutDir();
|
||||
@ -221,6 +217,10 @@ public class ApkDecoder {
|
||||
}
|
||||
}
|
||||
|
||||
public void setApiLevel(int apiLevel) {
|
||||
mApiLevel = apiLevel;
|
||||
}
|
||||
|
||||
public void setBaksmaliDebugMode(boolean bakDeb) {
|
||||
mBakDeb = bakDeb;
|
||||
}
|
||||
@ -420,11 +420,11 @@ public class ApkDecoder {
|
||||
meta.versionInfo = info;
|
||||
}
|
||||
|
||||
private void putSharedLibraryInfo(MetaInfo meta) {
|
||||
private void putSharedLibraryInfo(MetaInfo meta) throws AndrolibException {
|
||||
meta.sharedLibrary = mResTable.getSharedLibrary();
|
||||
}
|
||||
|
||||
private void putSparseResourcesInfo(MetaInfo meta) {
|
||||
private void putSparseResourcesInfo(MetaInfo meta) throws AndrolibException {
|
||||
meta.sparseResources = mResTable.getSparseResources();
|
||||
}
|
||||
|
||||
@ -454,5 +454,5 @@ public class ApkDecoder {
|
||||
private boolean mBakDeb = true;
|
||||
private Collection<String> mUncompressedFiles;
|
||||
private boolean mAnalysisMode = false;
|
||||
private int mApiLevel = 15;
|
||||
private int mApiLevel = 0;
|
||||
}
|
||||
|
@ -32,14 +32,11 @@ import java.io.InputStream;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class SmaliBuilder {
|
||||
|
||||
public static void build(ExtFile smaliDir, File dexFile, int apiLevel) throws AndrolibException {
|
||||
new SmaliBuilder(smaliDir, dexFile, apiLevel).build();
|
||||
}
|
||||
|
||||
public static void build(ExtFile smaliDir, File dexFile) throws AndrolibException {
|
||||
new SmaliBuilder(smaliDir, dexFile, 0).build();
|
||||
}
|
||||
|
||||
private SmaliBuilder(ExtFile smaliDir, File dexFile, int apiLevel) {
|
||||
mSmaliDir = smaliDir;
|
||||
mDexFile = dexFile;
|
||||
|
@ -67,7 +67,7 @@ public class SmaliDecoder {
|
||||
}
|
||||
|
||||
// create the container
|
||||
MultiDexContainer<? extends DexBackedDexFile> container = DexFileFactory.loadDexContainer(mApkFile, Opcodes.forApi(mApiLevel));
|
||||
MultiDexContainer<? extends DexBackedDexFile> container = DexFileFactory.loadDexContainer(mApkFile, mApiLevel > 0 ? Opcodes.forApi(mApiLevel) : null);
|
||||
MultiDexContainer.DexEntry<? extends DexBackedDexFile> dexEntry;
|
||||
DexBackedDexFile dexFile;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user