Commit e74cd445 authored by Administrator's avatar Administrator

aar格式文件导出为gradle失败

parent c52f0dbb
...@@ -11,7 +11,7 @@ dependencies { ...@@ -11,7 +11,7 @@ dependencies {
application { application {
applicationName = 'jadx' applicationName = 'jadx'
mainClassName = 'jadx.cli.JadxCLI' mainClassName = 'jadx.cli.JadxCLI'
applicationDefaultJvmArgs = ['-Xms128M', '-Xmx4g', '-XX:+UseG1GC'] applicationDefaultJvmArgs = ['-Xms8g', '-Xmx16g', '-XX:+UseG1GC']
} }
applicationDistribution.with { applicationDistribution.with {
......
...@@ -3,6 +3,9 @@ package jadx.core.export; ...@@ -3,6 +3,9 @@ package jadx.core.export;
import net.dongliu.apk.parser.ApkFile; import net.dongliu.apk.parser.ApkFile;
import net.dongliu.apk.parser.bean.ApkMeta; import net.dongliu.apk.parser.bean.ApkMeta;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
...@@ -10,9 +13,6 @@ import java.util.HashSet; ...@@ -10,9 +13,6 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import jadx.core.dex.attributes.AFlag; import jadx.core.dex.attributes.AFlag;
import jadx.core.dex.nodes.ClassNode; import jadx.core.dex.nodes.ClassNode;
import jadx.core.dex.nodes.DexNode; import jadx.core.dex.nodes.DexNode;
...@@ -73,10 +73,10 @@ public class ExportGradleProject { ...@@ -73,10 +73,10 @@ public class ExportGradleProject {
} }
} }
if (apkMeta != null) { if (apkMeta != null) {
tmpl.add("applicationId", apkMeta.getPackageName()); tmpl.add("applicationId", apkMeta.getPackageName(), appPackage);
tmpl.add("minSdkVersion", apkMeta.getMinSdkVersion()); tmpl.add("minSdkVersion", apkMeta.getMinSdkVersion(), 9);
tmpl.add("targetSdkVersion", apkMeta.getTargetSdkVersion()); tmpl.add("targetSdkVersion", apkMeta.getTargetSdkVersion(), 21);
tmpl.add("compileSdkVersion", apkMeta.getTargetSdkVersion()); tmpl.add("compileSdkVersion", apkMeta.getTargetSdkVersion(), 21);
} else { } else {
tmpl.add("applicationId", appPackage); tmpl.add("applicationId", appPackage);
tmpl.add("minSdkVersion", 9); tmpl.add("minSdkVersion", 9);
...@@ -86,6 +86,7 @@ public class ExportGradleProject { ...@@ -86,6 +86,7 @@ public class ExportGradleProject {
tmpl.save(new File(outDir, "build.gradle")); tmpl.save(new File(outDir, "build.gradle"));
} }
private void skipGeneratedClasses() { private void skipGeneratedClasses() {
for (DexNode dexNode : root.getDexNodes()) { for (DexNode dexNode : root.getDexNodes()) {
List<ClassNode> classes = dexNode.getClasses(); List<ClassNode> classes = dexNode.getClasses();
......
package jadx.core.export; package jadx.core.export;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.File; import java.io.File;
...@@ -11,9 +14,6 @@ import java.io.OutputStream; ...@@ -11,9 +14,6 @@ import java.io.OutputStream;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import jadx.core.utils.exceptions.JadxRuntimeException; import jadx.core.utils.exceptions.JadxRuntimeException;
import static jadx.core.utils.files.FileUtils.close; import static jadx.core.utils.files.FileUtils.close;
...@@ -55,6 +55,14 @@ public class TemplateFile { ...@@ -55,6 +55,14 @@ public class TemplateFile {
values.put(name, value.toString()); values.put(name, value.toString());
} }
public void add(String name, Object value, Object defaultValue) {
if (value == null) {
add(name, defaultValue);
} else {
add(name, value);
}
}
public String build() throws IOException { public String build() throws IOException {
ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream();
try { try {
......
...@@ -45,7 +45,7 @@ jar { ...@@ -45,7 +45,7 @@ jar {
startScripts { startScripts {
// The option -XX:+UseG1GC is only relevant for Java 8. Starting with Java 9 G1GC is already the default GC // The option -XX:+UseG1GC is only relevant for Java 8. Starting with Java 9 G1GC is already the default GC
defaultJvmOpts = ['-Xmx8g', '-Xmx12g', '-Dawt.useSystemAAFontSettings=lcd', '-Dswing.aatext=true', '-XX:+UseG1GC'] defaultJvmOpts = ['-Xmx8g', '-Xmx16g', '-Dawt.useSystemAAFontSettings=lcd', '-Dswing.aatext=true', '-XX:+UseG1GC']
doLast { doLast {
def str = windowsScript.text def str = windowsScript.text
str = str.replaceAll('java.exe', 'javaw.exe') str = str.replaceAll('java.exe', 'javaw.exe')
......
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