A pure java apk parser, to read encoded xml file and get apk infos, with no need for appt/dexdump binarys.
For now, the following is (partially) supported:
- resource table by ResourceTableParser
- binary xml file by BinaryXmlParser
- dex file by DexParser
- certificate by CetificateParser
If maven is used, you can add dependency:
<dependency>
<groupId>net.dongliu.apk-parser</groupId>
<artifactId>apk-parser</artifactId>
<version>1.2.0</version>
</dependency>
to your pom file.
The easiest way is to use the ApkParser class, which contains convenient mehods to get AndroidManifest.xml, apk meta infos, etc.
ApkParser apkParser = new ApkParser(new File(filePath));
if (locale != null) {
apkParser.setPreferredLocale(locale);
}
String xml = apkParser.getManifestXml();
System.out.println(xml);
ApkMeta apkMeta = apkParser.getApkMeta();
System.out.println(apkMeta);
Set<Locale> locales = apkParser.getLocales();
for (Locale l : locales) {
System.out.println(l);
}
apkParser.close();
Run
mvn assembly:assembly
to get all-in-one excuteable jar.
Usages:
java -jar apk-parser-all.jar -l en_US -t manifest [apkfile] # get apk manifest file as text xml
java -jar apk-parser-all.jar -l en_US -t info [apkfile] # get apk basic infos
Use java -jar apk-parser-all.jar -h to see more options.