{"id":13387455,"url":"https://github.com/jaredrummler/apkparser","last_synced_at":"2025-04-12T18:41:40.406Z","repository":{"id":49062398,"uuid":"45757120","full_name":"jaredrummler/APKParser","owner":"jaredrummler","description":"APK parser for Android","archived":false,"fork":false,"pushed_at":"2024-06-24T17:17:56.000Z","size":567,"stargazers_count":660,"open_issues_count":14,"forks_count":113,"subscribers_count":25,"default_branch":"master","last_synced_at":"2025-04-03T20:11:51.687Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jaredrummler.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-11-07T22:18:08.000Z","updated_at":"2025-03-21T00:31:21.000Z","dependencies_parsed_at":"2024-10-25T06:46:18.334Z","dependency_job_id":null,"html_url":"https://github.com/jaredrummler/APKParser","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredrummler%2FAPKParser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredrummler%2FAPKParser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredrummler%2FAPKParser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredrummler%2FAPKParser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaredrummler","download_url":"https://codeload.github.com/jaredrummler/APKParser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248616929,"owners_count":21134156,"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":[],"created_at":"2024-07-30T12:01:20.340Z","updated_at":"2025-04-12T18:41:40.367Z","avatar_url":"https://github.com/jaredrummler.png","language":"Java","funding_links":[],"categories":["\u003ca id=\"2110ded2aa5637fa933cc674bc33bf21\"\u003e\u003c/a\u003e工具"],"sub_categories":["\u003ca id=\"63fd2c592145914e99f837cecdc5a67c\"\u003e\u003c/a\u003e新添加的1"],"readme":"# APK Parser [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.jaredrummler/apk-parser/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.jaredrummler/apk-parser) [![Software License](https://img.shields.io/badge/license-BSD%203%20Clause-blue.svg)](LICENSE.txt) [![Twitter Follow](https://img.shields.io/twitter/follow/jrummy16.svg?style=social)](https://twitter.com/jrummy16)\n\n#### Features\n* Retrieve basic apk metas, such as title, icon, package name, version, etc.\n* Parse and convert binary xml file to text \n* Classes from dex file\n* Get certificate metas and verify apk signature\n\n![](sample/graphics/apk_parser_sample.png)\n\n#### Get apk-parser\nDownload [the latest AAR](https://repo1.maven.org/maven2/com/jaredrummler/apk-parser/1.0.2/apk-parser-1.0.2.aar) or grab via Gradle:\n\n```groovy\ncompile 'com.jaredrummler:apk-parser:1.0.2'\n```\n\n#### Usage\nThe easiest way is to use the ApkParser class, which contains convenient methods to get AndroidManifest.xml, apk meta infos, etc.\n#####1. Apk meta info\nApkMeta contains name(label), packageName, version, sdk, used features, etc.\n```java\nPackageManager pm = getPackageManager();\nApplicationInfo appInfo = pm.getApplicationInfo(\"com.facebook.katana\", 0);\nApkParser apkParser = ApkParser.create(appInfo);\nApkMeta meta = apkParser.getApkMeta();\nString packageName = meta.packageName;\nlong versionCode = meta.versionCode;\nList\u003cUseFeature\u003e usesFeatures = meta.usesFeatures;\nList\u003cString\u003e requestedPermissions = meta.usesPermissions;\n```\n#####2. Get binary xml and manifest xml file\n```java\nApplicationInfo appInfo = getPackageManager().getApplicationInfo(\"some.package.name\", 0);\nApkParser apkParser = ApkParser.create(appInfo);\nString readableAndroidManifest = apkParser.getManifestXml();\nString xml = apkParser.transBinaryXml(\"res/layout/activity_main.xml\");\n```\n#####3. Get dex classes\n```java\nApplicationInfo appInfo = getPackageManager().getApplicationInfo(\"com.instagram.android\", 0);\nApkParser apkParser = ApkParser.create(appInfo);\nList\u003cDexInfo\u003e dexFiles = apkParser.getDexInfos(); // if size \u003e 1 then app is using multidex\nfor (DexInfo dexInfo : dexFiles) {\n  DexClass[] dexClasses = dexInfo.classes;\n  DexHeader dexHeader = dexInfo.header;\n}\n```\n\n#####4. Get certificate and verify apk signature\n```java\nApplicationInfo appInfo = getPackageManager().getApplicationInfo(\"com.instagram.android\", 0);\nApkParser apkParser = ApkParser.create(appInfo);\nif (apkParser.verifyApk() == ApkParser.ApkSignStatus.SIGNED) {\n  System.out.println(apkParser.getCertificateMeta().signAlgorithm);\n}\n```\n\n#####5. Get intent-filters from apk manifest:\n```java\nApkParser parser = ApkParser.create(getPackageManager(), \"com.android.settings\");\nAndroidManifest androidManifest = parser.getAndroidManifest();\nfor (AndroidComponent component : androidManifest.getComponents()) {\n  if (!component.intentFilters.isEmpty()) {\n    for (IntentFilter intentFilter : component.intentFilters) {\n      // Got an intent filter for activity/service/provider/receiver.\n    }\n  }\n}\n```\n\n#####6. Locales\nApk may return different infos(title, icon, etc.) for different region and language, which is \ndetermined by Locales.\nIf the locale is not set, the \"en_US\" locale(\u003ccode\u003eLocale.US\u003c/code\u003e) is used. You can set the \nlocale like this:\n```java\nApkParser apkParser = ApkParser.create(filePath);\napkParser.setPreferredLocale(Locale.SIMPLIFIED_CHINESE);\nApkMeta apkMeta = apkParser.getApkMeta();\n```\nThe PreferredLocale parameter work for getApkMeta, getManifestXml, and other binary xmls.\nApk parser will find best match languages with locale you specified.\n\nIf locale is set to null, ApkParser will not translate resource tag, just give the resource id.\nFor example, apk title will be '@string/app_name' instead of 'WeChat'.\n\n___\n\nAPK Parser is based on [CaoQianLi's apk-parser](https://github.com/CaoQianLi/apk-parser)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaredrummler%2Fapkparser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaredrummler%2Fapkparser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaredrummler%2Fapkparser/lists"}