{"id":13647177,"url":"https://github.com/hsiafan/apk-parser","last_synced_at":"2025-09-28T21:31:06.498Z","repository":{"id":13115085,"uuid":"15796819","full_name":"hsiafan/apk-parser","owner":"hsiafan","description":"Apk parser for java","archived":true,"fork":false,"pushed_at":"2022-05-21T14:37:36.000Z","size":22537,"stargazers_count":1207,"open_issues_count":48,"forks_count":360,"subscribers_count":66,"default_branch":"master","last_synced_at":"2024-05-19T03:09:37.387Z","etag":null,"topics":["apk-parser"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hsiafan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-01-10T11:47:42.000Z","updated_at":"2024-05-15T09:37:09.000Z","dependencies_parsed_at":"2022-07-31T23:38:14.119Z","dependency_job_id":null,"html_url":"https://github.com/hsiafan/apk-parser","commit_stats":null,"previous_names":["xiaxiaocao/apk-parser"],"tags_count":35,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsiafan%2Fapk-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsiafan%2Fapk-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsiafan%2Fapk-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsiafan%2Fapk-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hsiafan","download_url":"https://codeload.github.com/hsiafan/apk-parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234563141,"owners_count":18853060,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apk-parser"],"created_at":"2024-08-02T01:03:22.864Z","updated_at":"2025-09-28T21:31:04.382Z","avatar_url":"https://github.com/hsiafan.png","language":"Java","funding_links":[],"categories":["Java"],"sub_categories":[],"readme":"APK parser lib, for decoding binary XML files, getting APK meta info.\n\nTable of Contents\n=================\n\n* [Features](#features)\n* [Get APK-parser](#get-apk-parser)\n* [Usage](#usage)\n    * [1. APK Info](#1-apk-info)\n    * [2. Get Binary XML and Manifest XML Files](#2-get-binary-xml-and-manifest-xml-file)\n    * [3. Get DEX Classes](#3-get-dex-classes)\n    * [4. Get APK Signing Info](#4-get-apk-sign-info)\n    * [5. Locales](#5-locales)\n* [Reporting Issues](#open-issue)\n\n#### Features\n\n* Retrieve APK meta info, such as title, icon, package name, version, etc.\n* Parse and convert binary XML files to text \n* Get classes from DEX files\n* Get APK singer info\n\n#### Get APK-parser\n\nGet APK-parser from the Maven Central Reposotiry:\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003enet.dongliu\u003c/groupId\u003e\n    \u003cartifactId\u003eapk-parser\u003c/artifactId\u003e\n    \u003cversion\u003e2.6.10\u003c/version\u003e\n\u003c/dependency\u003e\n```\nFrom version 2.0, apk-parser requires Java 7. The last version to support Java 6 is 1.7.4.\n\n#### Usage\n\nThe ordinary way is using the ApkFile class, which contains convenient methods to get AndroidManifest.xml, APK info, etc.\nThe ApkFile need to be closed when no longer used. \nThere is also a ByteArrayApkFile class for reading APK files from byte array.\n\n##### 1. APK Info\n\nApkMeta contains name(label), packageName, version, SDK, used features, etc.\n\n```java\ntry (ApkFile apkFile = new ApkFile(new File(filePath))) {\n    ApkMeta apkMeta = apkFile.getApkMeta();\n    System.out.println(apkMeta.getLabel());\n    System.out.println(apkMeta.getPackageName());\n    System.out.println(apkMeta.getVersionCode());\n    for (UseFeature feature : apkMeta.getUsesFeatures()) {\n        System.out.println(feature.getName());\n    }\n}\n```\n##### 2. Get Binary XML and Manifest XML Files\n\n```java\ntry (ApkFile apkFile = new ApkFile(new File(filePath))) {\n    String manifestXml = apkFile.getManifestXml();\n    String xml = apkFile.transBinaryXml(\"res/menu/main.xml\");\n}\n```\n\n##### 3. Get DEX Classes\n\n```java\ntry(ApkFile apkFile = new ApkFile(new File(filePath))) {\n    DexClass[] classes = apkFile.getDexClasses();\n    for (DexClass dexClass : classes) {\n        System.out.println(dexClass);\n    }\n}\n```\n\n##### 4. Get APK Signing Info\n\nGet the APK signer certificate info and other messages, using:\n\n```java\ntry(ApkFile apkFile = new ApkFile(new File(filePath))) {\n    List\u003cApkSigner\u003e signers = apkFile.getApkSingers(); // apk v1 signers\n    List\u003cApkV2Signer\u003e v2signers = apkFile.getApkV2Singers(); // apk v2 signers\n}\n```\n\n##### 5. Locales\n\nAn APK may have different info (title, icon, etc.) for different regions and languages——or we can call it a \"locale\".\nIf a locale is not set, the default \"en_US\" locale (\u003ccode\u003eLocale.US\u003c/code\u003e) is used. You can set a preferred locale by:\n\n```java\ntry (ApkFile apkFile = new ApkFile(new File(filePath))) {\n    apkFile.setPreferredLocale(Locale.SIMPLIFIED_CHINESE);\n    ApkMeta apkMeta = apkFile.getApkMeta();\n}\n```\n\nAPK-parser will find the best matching languages for the locale you specified.\n\nIf locale is set to null, ApkFile will not translate the resource tag, and instead just give the resource ID.\nFor example, the title will be something like '@string/app_name' instead of the real name.\n\n\n#### Reporting Issues\nIf this parser has any problem with a specific APK, open a new issue, **with a link to download the APK file**.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhsiafan%2Fapk-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhsiafan%2Fapk-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhsiafan%2Fapk-parser/lists"}