public class ApkParser
extends java.lang.Object
implements java.io.Closeable
| Modifier and Type | Class and Description |
|---|---|
static class |
ApkParser.ApkSignStatus |
static class |
ApkParser.InvalidApkException |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
static ApkParser |
create(android.content.pm.ApplicationInfo applicationInfo) |
static ApkParser |
create(java.io.File file) |
static ApkParser |
create(android.content.pm.PackageInfo packageInfo) |
static ApkParser |
create(android.content.pm.PackageManager pm,
java.lang.String packageName) |
static ApkParser |
create(java.lang.String path) |
AndroidManifest |
getAndroidManifest() |
ApkMeta |
getApkMeta() |
CertificateMeta |
getCertificateMeta() |
DexClass[] |
getDexClasses()
Deprecated.
|
DexHeader |
getDexHeader()
Deprecated.
|
DexInfo |
getDexInfo()
Get info about classes.dex.
|
java.util.List<DexInfo> |
getDexInfos()
Return all classes.dex files.
|
byte[] |
getFileData(java.lang.String path)
read file in apk into bytes
|
Icon |
getIconFile()
get the apk icon file as bytes.
|
java.util.Set<java.util.Locale> |
getLocales()
get locales supported from resource file
|
java.lang.String |
getManifestXml() |
java.util.Locale |
getPreferredLocale() |
void |
setPreferredLocale(java.util.Locale locale)
The locale preferred.
|
java.lang.String |
transBinaryXml(java.lang.String path)
trans binary xml file to text xml file.
|
int |
verifyApk() |
public static ApkParser create(android.content.pm.PackageManager pm, java.lang.String packageName) throws android.content.pm.PackageManager.NameNotFoundException
android.content.pm.PackageManager.NameNotFoundExceptionpublic static ApkParser create(android.content.pm.PackageInfo packageInfo)
public static ApkParser create(android.content.pm.ApplicationInfo applicationInfo)
public static ApkParser create(java.lang.String path)
public static ApkParser create(java.io.File file)
public java.lang.String getManifestXml()
throws java.io.IOException
java.io.IOExceptionpublic AndroidManifest getAndroidManifest() throws java.io.IOException, java.text.ParseException
java.io.IOException - if parsing the AndroidManifest failed.java.text.ParseExceptionpublic ApkMeta getApkMeta() throws java.io.IOException
java.io.IOExceptionpublic java.util.Set<java.util.Locale> getLocales()
throws java.io.IOException
java.io.IOExceptionpublic CertificateMeta getCertificateMeta() throws java.io.IOException, javax.security.cert.CertificateException
java.io.IOExceptionjavax.security.cert.CertificateExceptionpublic java.lang.String transBinaryXml(java.lang.String path)
throws java.io.IOException
path - the xml file path in apk filejava.io.IOExceptionpublic Icon getIconFile() throws java.io.IOException
java.io.IOExceptionpublic java.util.List<DexInfo> getDexInfos() throws java.io.IOException
java.io.IOException - if an error occurs while parsing the DEX file(s).public DexInfo getDexInfo() throws java.io.IOException
getDexInfos() for apps using multidex.java.io.IOException - if an error occurs while parsing classes.dex@Deprecated public DexClass[] getDexClasses() throws java.io.IOException
java.io.IOException@Deprecated public DexHeader getDexHeader() throws java.io.IOException
java.io.IOExceptionpublic byte[] getFileData(java.lang.String path)
throws java.io.IOException
java.io.IOExceptionpublic int verifyApk()
throws java.io.IOException
ApkParser.ApkSignStatus.SIGNED,
ApkParser.ApkSignStatus.NOT_SIGNED,
ApkParser.ApkSignStatus.INCORRECTjava.io.IOException - if reading the APK file failed.public void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablepublic java.util.Locale getPreferredLocale()
public void setPreferredLocale(java.util.Locale locale)