Commit 2079d31a authored by Administrator's avatar Administrator

修改

parent 0911b2dc
Pipeline #781 failed with stages
in 0 seconds
...@@ -31,3 +31,5 @@ jadx-output/ ...@@ -31,3 +31,5 @@ jadx-output/
*.log *.log
*.cfg *.cfg
*.orig *.orig
local.properties
...@@ -53,9 +53,14 @@ allprojects { ...@@ -53,9 +53,14 @@ allprojects {
repositories { repositories {
mavenLocal() mavenLocal()
mavenCentral() maven {
jcenter() name "aliyunmaven"
google() url "https://maven.aliyun.com/repository/public"
}
maven {
name "aliyunGoogle"
url "https://maven.aliyun.com/repository/google"
}
} }
jacoco { jacoco {
......
...@@ -56,10 +56,10 @@ public class JadxCLIArgs { ...@@ -56,10 +56,10 @@ public class JadxCLIArgs {
protected int threadsCount = JadxArgs.DEFAULT_THREADS_COUNT; protected int threadsCount = JadxArgs.DEFAULT_THREADS_COUNT;
@Parameter(names = { "--show-bad-code" }, description = "show inconsistent code (incorrectly decompiled)") @Parameter(names = { "--show-bad-code" }, description = "show inconsistent code (incorrectly decompiled)")
protected boolean showInconsistentCode = false; protected boolean showInconsistentCode = true;
@Parameter(names = { "--no-imports" }, description = "disable use of imports, always write entire package name") @Parameter(names = { "--no-imports" }, description = "disable use of imports, always write entire package name")
protected boolean useImports = true; protected boolean useImports = false;
@Parameter(names = { "--no-debug-info" }, description = "disable debug info") @Parameter(names = { "--no-debug-info" }, description = "disable debug info")
protected boolean debugInfo = true; protected boolean debugInfo = true;
......
...@@ -14,5 +14,7 @@ dependencies { ...@@ -14,5 +14,7 @@ dependencies {
} }
compile 'com.google.guava:guava:28.0-jre' compile 'com.google.guava:guava:28.0-jre'
compile 'net.dongliu:apk-parser:2.6.2'
testCompile 'org.apache.commons:commons-lang3:3.9' testCompile 'org.apache.commons:commons-lang3:3.9'
} }
...@@ -74,11 +74,26 @@ public class JadxArgsValidator { ...@@ -74,11 +74,26 @@ public class JadxArgsValidator {
File file = args.getInputFiles().get(0); File file = args.getInputFiles().get(0);
String name = file.getName(); String name = file.getName();
int pos = name.lastIndexOf('.'); int pos = name.lastIndexOf('.');
if (pos != -1) { // if (pos != -1) {
outDirName = name.substring(0, pos); // outDirName = name.substring(0, pos);
// } else {
// outDirName = name + '-' + JadxArgs.DEFAULT_OUT_DIR;
// }
if (args.isExportAsGradleProject()) {
if (pos != -1) {
name = name.substring(0, pos);
}
outDirName = name + "_gradle_project";
} else { } else {
outDirName = name + '-' + JadxArgs.DEFAULT_OUT_DIR; outDirName = name + "-" + JadxArgs.DEFAULT_OUT_DIR;
if (pos != -1) {
outDirName = name.substring(0, pos);
} else {
outDirName = name + "-" + JadxArgs.DEFAULT_OUT_DIR;
}
} }
LOG.info("output directory: {}", outDirName); LOG.info("output directory: {}", outDirName);
outDir = new File(outDirName); outDir = new File(outDirName);
return outDir; return outDir;
......
package jadx.core.export; package jadx.core.export;
import net.dongliu.apk.parser.ApkFile;
import net.dongliu.apk.parser.bean.ApkMeta;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
...@@ -54,10 +57,32 @@ public class ExportGradleProject { ...@@ -54,10 +57,32 @@ public class ExportGradleProject {
if (appPackage == null) { if (appPackage == null) {
appPackage = "UNKNOWN"; appPackage = "UNKNOWN";
} }
tmpl.add("applicationId", appPackage); // tmpl.add("applicationId", appPackage);
// TODO: load from AndroidManifest.xml // // TODO: load from AndroidManifest.xml
tmpl.add("minSdkVersion", 9); // tmpl.add("minSdkVersion", 9);
tmpl.add("targetSdkVersion", 21); // tmpl.add("targetSdkVersion", 21);
// tmpl.save(new File(outDir, "build.gradle"));
ApkMeta apkMeta = null;
for (File f : root.getArgs().getInputFiles()) {
try (ApkFile apkFile = new ApkFile(f)) {
apkMeta = apkFile.getApkMeta();
break;
} catch (Exception e) {
//ignore
}
}
if (apkMeta != null) {
tmpl.add("applicationId", apkMeta.getPackageName());
tmpl.add("minSdkVersion", apkMeta.getMinSdkVersion());
tmpl.add("targetSdkVersion", apkMeta.getTargetSdkVersion());
tmpl.add("compileSdkVersion", apkMeta.getTargetSdkVersion());
} else {
tmpl.add("applicationId", appPackage);
tmpl.add("minSdkVersion", 9);
tmpl.add("targetSdkVersion", 21);
tmpl.add("compileSdkVersion", 21);
}
tmpl.save(new File(outDir, "build.gradle")); tmpl.save(new File(outDir, "build.gradle"));
} }
......
//modified by virjar https://gitee.com/virjar/jadx
buildscript { buildscript {
repositories { repositories {
jcenter() maven {
name "aliyunmaven"
url "https://maven.aliyun.com/repository/public"
}
maven {
name "aliyunGoogle"
url "https://maven.aliyun.com/repository/google"
}
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:1.5.0' classpath 'com.android.tools.build:gradle:3.4.2'
} }
} }
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
repositories { repositories {
mavenCentral() maven {
jcenter() name "aliyunmaven"
url "https://maven.aliyun.com/repository/public"
}
maven {
name "aliyunGoogle"
url "https://maven.aliyun.com/repository/google"
}
} }
android { android {
compileSdkVersion 23 compileSdkVersion {{compileSdkVersion}}
buildToolsVersion '23.0.1' //buildToolsVersion '23.0.1'
defaultConfig { defaultConfig {
applicationId '{{applicationId}}' applicationId '{{applicationId}}'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment