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"
......
......@@ -114,7 +114,6 @@ public class ClsSet {
try {
out.putNextEntry(new ZipEntry(CLST_PKG_PATH + "/" + CLST_FILENAME));
save(out);
out.closeEntry();
} finally {
out.close();
}
......
......@@ -63,7 +63,10 @@ public class ConvertToClsSet {
if (file.isDirectory()) {
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));
}
}
......
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;
public class BinaryXMLParser extends CommonBinaryParser {
private static final Logger LOG = LoggerFactory.getLogger(BinaryXMLParser.class);
private static final String ANDROID_R_STYLE_CLS = "android.R$style";
private CodeWriter writer;
private String[] strings;
......@@ -51,8 +52,13 @@ public class BinaryXMLParser extends CommonBinaryParser {
public BinaryXMLParser(RootNode root) {
try {
for (Field f : AndroidR.style.class.getFields()) {
styleMap.put(f.getInt(f.getType()), f.getName());
try {
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
for (DexNode dexNode : root.getDexNodes()) {
......
package jadx.core.xmlgen;
import jadx.core.utils.exceptions.JadxException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.InputStream;
......@@ -17,7 +19,7 @@ import org.w3c.dom.NodeList;
public class ManifestAttributes {
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 {
ENUM, FLAG
......@@ -52,6 +54,9 @@ public class ManifestAttributes {
InputStream xmlStream = null;
try {
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();
doc = dBuilder.parse(xmlStream);
} 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