From be73563c43113c9d4d9a1b83a6cd1961e2c826fb Mon Sep 17 00:00:00 2001 From: Connor Tumbleson Date: Thu, 2 May 2013 12:56:18 -0500 Subject: [PATCH] handle all version(s) as strings, and change java to 1.7 --- .../brut/androlib/res/AndrolibResources.java | 5 ++-- .../res/decoder/XmlPullStreamDecoder.java | 30 +++++++++---------- build.gradle | 4 +-- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/AndrolibResources.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/AndrolibResources.java index b5c539b3..45e7c4ae 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/AndrolibResources.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/AndrolibResources.java @@ -361,8 +361,8 @@ final public class AndrolibResources { public void setVersionInfo(Map map) { if (map != null) { - mVersionCode = map.get("versionCode"); - mVersionName = map.get("versionName"); + mVersionCode = map.get("versionCode").toString(); + mVersionName = map.get("versionName").toString(); } } @@ -712,7 +712,6 @@ final public class AndrolibResources { out = new ZipArchiveOutputStream(new FileOutputStream(outFile)); out.setMethod(ZipOutputStream.STORED); - CRC32 crc = new CRC32(); crc.update(data); entry = new ZipArchiveEntry("resources.arsc"); diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/XmlPullStreamDecoder.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/XmlPullStreamDecoder.java index 28f9dd8e..1b014600 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/XmlPullStreamDecoder.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/XmlPullStreamDecoder.java @@ -87,22 +87,22 @@ public class XmlPullStreamDecoder implements ResStreamDecoder { super.event(pp); } - private boolean parseManifest(XmlPullParser pp) - throws AndrolibException { - ResTable restable = resTable; + private boolean parseManifest(XmlPullParser pp) + throws AndrolibException { + ResTable restable = resTable; - // read for package: - for (int i = 0; i < pp.getAttributeCount(); i++) { - if (pp.getAttributeName(i).equalsIgnoreCase(("package"))) { - restable.addPackageInfo("orig_package",pp.getAttributeValue(i)); - } else if (pp.getAttributeName(i).equalsIgnoreCase("versionCode")) { - restable.addVersionInfo("versionCode", pp.getAttributeValue(i)); - } else if (pp.getAttributeName(i).equalsIgnoreCase("versionName")) { - restable.addVersionInfo("versionName", pp.getAttributeValue(i)); - } - } - return true; - } + // read for package: + for (int i = 0; i < pp.getAttributeCount(); i++) { + if (pp.getAttributeName(i).equalsIgnoreCase(("package"))) { + restable.addPackageInfo("orig_package",pp.getAttributeValue(i)); + } else if (pp.getAttributeName(i).equalsIgnoreCase("versionCode")) { + restable.addVersionInfo("versionCode", pp.getAttributeValue(i).toString()); + } else if (pp.getAttributeName(i).equalsIgnoreCase("versionName")) { + restable.addVersionInfo("versionName", pp.getAttributeValue(i).toString()); + } + } + return true; + } private boolean parseAttr(XmlPullParser pp) throws AndrolibException { diff --git a/build.gradle b/build.gradle index e21772f6..9e3d064f 100644 --- a/build.gradle +++ b/build.gradle @@ -25,8 +25,8 @@ repositories { mavenCentral() } -sourceCompatibility = 1.6 -targetCompatibility = 1.6 +sourceCompatibility = 1.7 +targetCompatibility = 1.7 class Compatibility { String version