日期:2014-05-17 浏览次数:20806 次
public static void apk(String apkUrl) {求大神帮忙,怎么获取apk的启动类
int length;
ZipFile zipFile;
try {
zipFile = new ZipFile(new File(apkUrl));
Enumeration enumeration = zipFile.entries();
ZipEntry zipEntry = zipFile.getEntry(("AndroidManifest.xml"));
AXmlResourceParser parser = new AXmlResourceParser();
parser.open(zipFile.getInputStream(zipEntry));
boolean flag = true;
while (flag) {
int type = parser.next();
if (type == XmlPullParser.START_TAG) {
int count = parser.getAttributeCount();
for (int i = 0; i < count; i++) {
String name = parser.getAttributeName(i);
String value = parser.getAttributeValue(i);
if (value.contains("MAIN")) {
System.out.println(name + "-----------" + value);
flag = false;
break;
}else if("package".equals(name)){
System.out.println(name+"***"+value);
}else{
System.out.println(name+" "+value);
}
}//end for
}
}// end while
} catch (Exception e) {
}
}