AndroidDeveloperLB / apk-parser

BSD 2-Clause "Simplified" License
25 stars 11 forks source link

APK-parser , revived

Apk parser for java/Android/Kotlin, forked from here after fixing some issues in it and collecting some fixes from others.

I personally use it for my own spare time app, App Manager.

Screenshot from the sample:

image

Why use this library, as we can do it using the Android framework instead?

While the Android framework is more official and should work better in most cases, there are multiple reasons to use this library :

  1. Can handle APK files that are not on the file system. The Android framework requires you to use a file path, always (using PackageManager.getPackageArchiveInfo).
  2. Can handle split APK files too. The Android framework can only handle the base ones or stand-alone files.
  3. Can find some APK properties that aren't available on older Android versions, such as ApplicationInfo.minSdkVersion.
  4. While the Android framework is technically open sourced, it has various things that are protected and can't be reached, and also hard to import as your own code.

So, what I suggest is to first try to use what Android officially offers, and if it fails, use this library.

Usage in gradle file

https://jitpack.io/#AndroidDeveloperLB/apk-parser/

How to use

You can use what's on the original repository (meaning creating a new instance of ApkFile, as shown here), or you can have a more advanced usage of parsing the exact things you want, as on the sample.

Known issues and notes