private static String apkPath = "E:\\ApkTool\\JSQ.apk";
public static void main(String[] args) throws IOException, XmlPullParserException {
ProcessManifest processManifest = new ProcessManifest(apkPath);
System.out.println("packagename:" +processManifest.getManifest().getAttribute("package"));
Iterator<BinaryManifestActivity> itact = processManifest.getActivities().iterator();
while (itact.hasNext()){
String name = itact.next().getNameString();
System.out.println("activity: " + name);
}
Iterator<BinaryManifestService> itser = processManifest.getServices().iterator();
while (itser.hasNext()){
String name = itser.next().getNameString();
System.out.println("services: "+name);
}
Iterator<BinaryManifestBroadcastReceiver> itrec = processManifest.getBroadcastReceivers().iterator();
while (itrec.hasNext()){
String name = itrec.next().getNameString();
System.out.println("receives: " + name);
}
Iterator<BinaryManifestContentProvider> itpro = processManifest.getContentProviders().iterator();
while (itpro.hasNext()){
String name = itpro.next().getNameString();
System.out.println("providers: " + name);
}
Iterator<String> itper = processManifest.getPermissions().iterator();
while (itper.hasNext()){
String name = itper.next();
System.out.println("Permissions: "+name);
}
Iterator<AXmlNode> itInt = processManifest.getLaunchableActivityNodes().iterator();
while (itInt.hasNext()){
String name = itInt.next().toString();
System.out.println("Intent" + name);
}
System.out.println(processManifest.getMinSdkVersion());
System.out.println(processManifest.getTargetSdkVersion());
废话不多说,网上其他版本提供代码有误,不适用与2.9.0版,此代码为最新版获取安卓apk的基本信息,大家看看就可以明白,如果有问题可以私信,最近在研究静态分析android分析,各位兄弟可以一起交流探讨。
|