mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-08 19:16:09 +01:00
fix jar disassembling
This commit is contained in:
parent
87e39c4bb9
commit
2ef25fe5e2
1
CHANGES
1
CHANGES
@ -25,6 +25,7 @@ v2.0.0 (TBA)
|
|||||||
-Fixed (issue #426) - Filename too long (JesusFreke)
|
-Fixed (issue #426) - Filename too long (JesusFreke)
|
||||||
-Fixed (issue #524) - INSTALL_FAILED_DEXOPT fix (JesusFreke)
|
-Fixed (issue #524) - INSTALL_FAILED_DEXOPT fix (JesusFreke)
|
||||||
-Fixed (issue #473) - multiple package frameworks are treated correctly.
|
-Fixed (issue #473) - multiple package frameworks are treated correctly.
|
||||||
|
-Fixed (issue #531) - JAR disassembling borking is fixed
|
||||||
-Added output to list Apktool version to help debugging.
|
-Added output to list Apktool version to help debugging.
|
||||||
-Updated known bytes for configurations to 38 (from addition of layout direction)
|
-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)
|
-Fixed NPE when handling odex apks even with --no-src specified. (Thanks Rodrigo Chiossi)
|
||||||
|
@ -144,6 +144,9 @@ public class Main {
|
|||||||
if (cli.hasOption("m") || cli.hasOption("match-original")) {
|
if (cli.hasOption("m") || cli.hasOption("match-original")) {
|
||||||
decoder.setAnalysisMode(true, false);
|
decoder.setAnalysisMode(true, false);
|
||||||
}
|
}
|
||||||
|
if (cli.hasOption("api")) {
|
||||||
|
decoder.setApi(Integer.parseInt(cli.getOptionValue("api")));
|
||||||
|
}
|
||||||
if (cli.hasOption("o") || cli.hasOption("output")) {
|
if (cli.hasOption("o") || cli.hasOption("output")) {
|
||||||
outDir = new File(cli.getOptionValue("o"));
|
outDir = new File(cli.getOptionValue("o"));
|
||||||
decoder.setOutDir(outDir);
|
decoder.setOutDir(outDir);
|
||||||
@ -295,6 +298,12 @@ public class Main {
|
|||||||
.withArgName("prefix")
|
.withArgName("prefix")
|
||||||
.create();
|
.create();
|
||||||
|
|
||||||
|
Option apiLevelOption = OptionBuilder.withLongOpt("api")
|
||||||
|
.withDescription("The numeric api-level of the file to generate, e.g. 14 for ICS.")
|
||||||
|
.hasArg(true)
|
||||||
|
.withArgName("API")
|
||||||
|
.create();
|
||||||
|
|
||||||
Option debugBuiOption = OptionBuilder.withLongOpt("debug")
|
Option debugBuiOption = OptionBuilder.withLongOpt("debug")
|
||||||
.withDescription("Builds in debug mode. Check project page for more info.")
|
.withDescription("Builds in debug mode. Check project page for more info.")
|
||||||
.create("d");
|
.create("d");
|
||||||
@ -377,6 +386,7 @@ public class Main {
|
|||||||
DecodeOptions.addOption(noDbgOption);
|
DecodeOptions.addOption(noDbgOption);
|
||||||
DecodeOptions.addOption(keepResOption);
|
DecodeOptions.addOption(keepResOption);
|
||||||
DecodeOptions.addOption(analysisOption);
|
DecodeOptions.addOption(analysisOption);
|
||||||
|
DecodeOptions.addOption(apiLevelOption);
|
||||||
|
|
||||||
BuildOptions.addOption(debugBuiOption);
|
BuildOptions.addOption(debugBuiOption);
|
||||||
BuildOptions.addOption(aaptOption);
|
BuildOptions.addOption(aaptOption);
|
||||||
|
@ -64,6 +64,10 @@ public class ApkDecoder {
|
|||||||
mOutDir = outDir;
|
mOutDir = outDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setApi(int api) {
|
||||||
|
mApi = api;
|
||||||
|
}
|
||||||
|
|
||||||
public void decode() throws AndrolibException, IOException {
|
public void decode() throws AndrolibException, IOException {
|
||||||
File outDir = getOutDir();
|
File outDir = getOutDir();
|
||||||
|
|
||||||
@ -85,9 +89,15 @@ public class ApkDecoder {
|
|||||||
LOGGER.info("Using Apktool " + Androlib.getVersion() + " on " + mApkFile.getName());
|
LOGGER.info("Using Apktool " + Androlib.getVersion() + " on " + mApkFile.getName());
|
||||||
|
|
||||||
if (hasResources()) {
|
if (hasResources()) {
|
||||||
|
|
||||||
|
Map<String, String> sdkInfo = mAndrolib.getResTable(mApkFile).getSdkInfo();
|
||||||
|
|
||||||
|
if (sdkInfo.get("targetSdkVersion") != null) {
|
||||||
|
mApi = Integer.parseInt(sdkInfo.get("targetSdkVersion"));
|
||||||
|
}
|
||||||
|
|
||||||
setAnalysisMode(mAnalysisMode, true);
|
setAnalysisMode(mAnalysisMode, true);
|
||||||
// read the resources.arsc checking for STORED vs DEFLATE
|
// read the resources.arsc checking for STORED vs DEFLATE
|
||||||
// compression
|
|
||||||
// this will determine whether we compress on rebuild or not.
|
// this will determine whether we compress on rebuild or not.
|
||||||
ZipExtFile zef = new ZipExtFile(mApkFile.getAbsolutePath());
|
ZipExtFile zef = new ZipExtFile(mApkFile.getAbsolutePath());
|
||||||
ZipArchiveEntry ze = zef.getEntry("resources.arsc");
|
ZipArchiveEntry ze = zef.getEntry("resources.arsc");
|
||||||
@ -122,8 +132,7 @@ public class ApkDecoder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, String> sdkInfo = mAndrolib.getResTable(mApkFile).getSdkInfo();
|
|
||||||
int api = (sdkInfo.get("targetSdkVersion") != null) ? Integer.parseInt(sdkInfo.get("targetSdkVersion")) : mDefaultApi;
|
|
||||||
|
|
||||||
if (hasSources()) {
|
if (hasSources()) {
|
||||||
switch (mDecodeSources) {
|
switch (mDecodeSources) {
|
||||||
@ -131,7 +140,7 @@ public class ApkDecoder {
|
|||||||
mAndrolib.decodeSourcesRaw(mApkFile, outDir, mDebug);
|
mAndrolib.decodeSourcesRaw(mApkFile, outDir, mDebug);
|
||||||
break;
|
break;
|
||||||
case DECODE_SOURCES_SMALI:
|
case DECODE_SOURCES_SMALI:
|
||||||
mAndrolib.decodeSourcesSmali(mApkFile, outDir, mDebug, mDebugLinePrefix, mBakDeb, api);
|
mAndrolib.decodeSourcesSmali(mApkFile, outDir, mDebug, mDebugLinePrefix, mBakDeb, mApi);
|
||||||
break;
|
break;
|
||||||
case DECODE_SOURCES_JAVA:
|
case DECODE_SOURCES_JAVA:
|
||||||
mAndrolib.decodeSourcesJava(mApkFile, outDir, mDebug);
|
mAndrolib.decodeSourcesJava(mApkFile, outDir, mDebug);
|
||||||
@ -359,7 +368,7 @@ public class ApkDecoder {
|
|||||||
private String mFrameTag;
|
private String mFrameTag;
|
||||||
private boolean mKeepBrokenResources = false;
|
private boolean mKeepBrokenResources = false;
|
||||||
private String mFrameworkDir = null;
|
private String mFrameworkDir = null;
|
||||||
private int mDefaultApi = 15;
|
private int mApi = 15;
|
||||||
private boolean mBakDeb = true;
|
private boolean mBakDeb = true;
|
||||||
private boolean mCompressResources = false;
|
private boolean mCompressResources = false;
|
||||||
private boolean mAnalysisMode = false;
|
private boolean mAnalysisMode = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user