Commit cc4d9432 authored by Skylot's avatar Skylot

core: update android files to 5.1 (fix #58)

parent c1292dff
ext.jadxClasspath = 'clsp-data/android-4.3.jar' ext.jadxClasspath = 'clsp-data/android-5.1.jar'
apply plugin: "info.solidsoft.pitest" apply plugin: "info.solidsoft.pitest"
......
...@@ -114,7 +114,6 @@ public class ClsSet { ...@@ -114,7 +114,6 @@ public class ClsSet {
try { try {
out.putNextEntry(new ZipEntry(CLST_PKG_PATH + "/" + CLST_FILENAME)); out.putNextEntry(new ZipEntry(CLST_PKG_PATH + "/" + CLST_FILENAME));
save(out); save(out);
out.closeEntry();
} finally { } finally {
out.close(); out.close();
} }
......
...@@ -63,7 +63,10 @@ public class ConvertToClsSet { ...@@ -63,7 +63,10 @@ public class ConvertToClsSet {
if (file.isDirectory()) { if (file.isDirectory()) {
addFilesFromDirectory(file, inputFiles); addFilesFromDirectory(file, inputFiles);
} }
if (file.getName().endsWith(".dex")) { String fileName = file.getName();
if (fileName.endsWith(".dex")
|| fileName.endsWith(".jar")
|| fileName.endsWith(".apk")) {
inputFiles.add(new InputFile(file)); inputFiles.add(new InputFile(file));
} }
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -31,6 +31,7 @@ import org.slf4j.LoggerFactory; ...@@ -31,6 +31,7 @@ import org.slf4j.LoggerFactory;
public class BinaryXMLParser extends CommonBinaryParser { public class BinaryXMLParser extends CommonBinaryParser {
private static final Logger LOG = LoggerFactory.getLogger(BinaryXMLParser.class); private static final Logger LOG = LoggerFactory.getLogger(BinaryXMLParser.class);
private static final String ANDROID_R_STYLE_CLS = "android.R$style";
private CodeWriter writer; private CodeWriter writer;
private String[] strings; private String[] strings;
...@@ -51,8 +52,13 @@ public class BinaryXMLParser extends CommonBinaryParser { ...@@ -51,8 +52,13 @@ public class BinaryXMLParser extends CommonBinaryParser {
public BinaryXMLParser(RootNode root) { public BinaryXMLParser(RootNode root) {
try { try {
for (Field f : AndroidR.style.class.getFields()) { try {
styleMap.put(f.getInt(f.getType()), f.getName()); Class rStyleCls = Class.forName(ANDROID_R_STYLE_CLS);
for (Field f : rStyleCls.getFields()) {
styleMap.put(f.getInt(f.getType()), f.getName());
}
} catch (Throwable th) {
LOG.error("R class loading failed", th);
} }
// add application constants // add application constants
for (DexNode dexNode : root.getDexNodes()) { for (DexNode dexNode : root.getDexNodes()) {
......
package jadx.core.xmlgen; package jadx.core.xmlgen;
import jadx.core.utils.exceptions.JadxException;
import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilderFactory;
import java.io.InputStream; import java.io.InputStream;
...@@ -17,7 +19,7 @@ import org.w3c.dom.NodeList; ...@@ -17,7 +19,7 @@ import org.w3c.dom.NodeList;
public class ManifestAttributes { public class ManifestAttributes {
private static final Logger LOG = LoggerFactory.getLogger(ManifestAttributes.class); private static final Logger LOG = LoggerFactory.getLogger(ManifestAttributes.class);
private static final String MANIFEST_ATTR_XML = "/attrs_manifest.xml"; private static final String MANIFEST_ATTR_XML = "/android/attrs_manifest.xml";
private enum MAttrType { private enum MAttrType {
ENUM, FLAG ENUM, FLAG
...@@ -52,6 +54,9 @@ public class ManifestAttributes { ...@@ -52,6 +54,9 @@ public class ManifestAttributes {
InputStream xmlStream = null; InputStream xmlStream = null;
try { try {
xmlStream = ManifestAttributes.class.getResourceAsStream(MANIFEST_ATTR_XML); xmlStream = ManifestAttributes.class.getResourceAsStream(MANIFEST_ATTR_XML);
if (xmlStream == null) {
throw new JadxException(MANIFEST_ATTR_XML + " not found in classpath");
}
DocumentBuilder dBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); DocumentBuilder dBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
doc = dBuilder.parse(xmlStream); doc = dBuilder.parse(xmlStream);
} finally { } finally {
......
This diff is collapsed.
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