mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-21 01:07:34 +01:00
Upgrade to smali 2.2
This commit is contained in:
parent
6cc251249c
commit
74f76ae71d
@ -16,6 +16,7 @@
|
||||
apply plugin: 'eu.appsatori.fatjar'
|
||||
|
||||
dependencies {
|
||||
compile depends.commons_cli
|
||||
compile project(':brut.apktool:apktool-lib')
|
||||
}
|
||||
|
||||
|
@ -16,9 +16,6 @@
|
||||
|
||||
package brut.androlib;
|
||||
|
||||
import org.jf.baksmali.baksmali;
|
||||
import org.jf.smali.main;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
@ -51,7 +48,7 @@ public class ApktoolProperties {
|
||||
|
||||
InputStream templateStream = null;
|
||||
try {
|
||||
templateStream = baksmali.class.getClassLoader().getResourceAsStream("baksmali.properties");
|
||||
templateStream = org.jf.baksmali.Main.class.getClassLoader().getResourceAsStream("baksmali.properties");
|
||||
} catch(NoClassDefFoundError ex) {
|
||||
LOGGER.warning("Can't load baksmali properties.");
|
||||
}
|
||||
@ -69,7 +66,7 @@ public class ApktoolProperties {
|
||||
|
||||
templateStream = null;
|
||||
try {
|
||||
templateStream = main.class.getClassLoader().getResourceAsStream("smali.properties");
|
||||
templateStream = org.jf.smali.Main.class.getClassLoader().getResourceAsStream("smali.properties");
|
||||
} catch(NoClassDefFoundError ex) {
|
||||
LOGGER.warning("Can't load smali properties.");
|
||||
}
|
||||
|
@ -50,9 +50,9 @@ public class SmaliBuilder {
|
||||
try {
|
||||
DexBuilder dexBuilder;
|
||||
if (mApiLevel > 0) {
|
||||
dexBuilder = DexBuilder.makeDexBuilder(Opcodes.forApi(mApiLevel));
|
||||
dexBuilder = new DexBuilder(Opcodes.forApi(mApiLevel));
|
||||
} else {
|
||||
dexBuilder = DexBuilder.makeDexBuilder();
|
||||
dexBuilder = new DexBuilder(Opcodes.getDefault());
|
||||
}
|
||||
|
||||
for (String fileName : mSmaliDir.getDirectory().getFiles(true)) {
|
||||
|
@ -17,9 +17,10 @@
|
||||
package brut.androlib.src;
|
||||
|
||||
import brut.androlib.AndrolibException;
|
||||
import org.jf.baksmali.baksmali;
|
||||
import org.jf.baksmali.baksmaliOptions;
|
||||
import org.jf.baksmali.Baksmali;
|
||||
import org.jf.baksmali.BaksmaliOptions;
|
||||
import org.jf.dexlib2.DexFileFactory;
|
||||
import org.jf.dexlib2.Opcodes;
|
||||
import org.jf.dexlib2.dexbacked.DexBackedDexFile;
|
||||
import org.jf.dexlib2.dexbacked.DexBackedOdexFile;
|
||||
import org.jf.dexlib2.analysis.InlineMethodResolver;
|
||||
@ -47,31 +48,28 @@ public class SmaliDecoder {
|
||||
|
||||
private void decode() throws AndrolibException {
|
||||
try {
|
||||
baksmaliOptions options = new baksmaliOptions();
|
||||
BaksmaliOptions options = new BaksmaliOptions();
|
||||
|
||||
// options
|
||||
options.deodex = false;
|
||||
options.outputDirectory = mOutDir.toString();
|
||||
options.noParameterRegisters = false;
|
||||
options.useLocalsDirective = true;
|
||||
options.useSequentialLabels = true;
|
||||
options.outputDebugInfo = mBakDeb;
|
||||
options.addCodeOffsets = false;
|
||||
options.jobs = -1;
|
||||
options.noAccessorComments = false;
|
||||
options.implicitReferences = false;
|
||||
options.parameterRegisters = false;
|
||||
options.localsDirective = true;
|
||||
options.sequentialLabels = true;
|
||||
options.debugInfo = mBakDeb;
|
||||
options.codeOffsets = false;
|
||||
options.accessorComments = false;
|
||||
options.registerInfo = 0;
|
||||
options.ignoreErrors = false;
|
||||
options.inlineResolver = null;
|
||||
options.checkPackagePrivateAccess = false;
|
||||
|
||||
// set jobs automatically
|
||||
options.jobs = Runtime.getRuntime().availableProcessors();
|
||||
if (options.jobs > 6) {
|
||||
options.jobs = 6;
|
||||
int jobs = Runtime.getRuntime().availableProcessors();
|
||||
if (jobs > 6) {
|
||||
jobs = 6;
|
||||
}
|
||||
|
||||
// create the dex
|
||||
DexBackedDexFile dexFile = DexFileFactory.loadDexFile(mApkFile, mDexFile, mApi, false);
|
||||
DexBackedDexFile dexFile = DexFileFactory.loadDexEntry(mApkFile, mDexFile, true, Opcodes.forApi(mApi));
|
||||
|
||||
if (dexFile.isOdexFile()) {
|
||||
throw new AndrolibException("Warning: You are disassembling an odex file without deodexing it.");
|
||||
@ -82,7 +80,7 @@ public class SmaliDecoder {
|
||||
InlineMethodResolver.createInlineMethodResolver(((DexBackedOdexFile)dexFile).getOdexVersion());
|
||||
}
|
||||
|
||||
baksmali.disassembleDexFile(dexFile, options);
|
||||
Baksmali.disassembleDexFile(dexFile, mOutDir, jobs, options);
|
||||
} catch (IOException ex) {
|
||||
throw new AndrolibException(ex);
|
||||
}
|
||||
|
@ -85,8 +85,8 @@ subprojects {
|
||||
|
||||
ext {
|
||||
depends = [
|
||||
baksmali: 'org.smali:baksmali:2.1.3',
|
||||
commons_cli: 'commons-cli:commons-cli:1.2',
|
||||
baksmali: 'org.smali:baksmali:2.2.0',
|
||||
commons_cli: 'commons-cli:commons-cli:1.4',
|
||||
commons_io: 'commons-io:commons-io:2.4',
|
||||
commons_lang: 'org.apache.commons:commons-lang3:3.1',
|
||||
findbugs: 'com.google.code.findbugs:jsr305:3.0.1',
|
||||
@ -94,7 +94,7 @@ subprojects {
|
||||
junit: 'junit:junit:4.12',
|
||||
proguard_gradle: 'net.sf.proguard:proguard-gradle:5.2.1',
|
||||
snakeyaml: 'org.yaml:snakeyaml:1.17',
|
||||
smali: 'org.smali:smali:2.1.3',
|
||||
smali: 'org.smali:smali:2.2.0',
|
||||
xmlpull: 'xpp3:xpp3:1.1.4c',
|
||||
xmlunit: 'xmlunit:xmlunit:1.3',
|
||||
]
|
||||
|
Loading…
x
Reference in New Issue
Block a user