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