hsiafan/apk-parser

Request: add a field to tell which kind of APK we have

AndroidDeveloperLB opened this issue · 1 comments

I suggest to add a field that says which kind this APK file is :

  • A normal standalone APK - true if not of the other types mentioned below.
  • A base APK of split apks - true if apkFile.apkMeta.isSplitRequired is true or in case it's not defined, if in "application" tag there is a "meta-data" with name that is com.android.vending.splits"
  • A split APK - true if apkFile.apkMeta.split is not null

Seems my algorithm doesn't always do it right.

There is "meta-data" of "com.android.vending.splits" (resource value) which might have a value yet not really mean it has split apks.
There is also a "meta-data" of "com.android.vending.splits.required" (boolean value) which doesn't always exist.
And, there is "meta-data" of "instantapps.clients.allowed" that is another type of split apks.

So, there should be another type:

  • Standalone or base of split APKs (meaning we are sure it's not a split APK, but not sure about more information about it)

And the algorithm should be as such:

  • apkFile.apkMeta.split not null -> a split APK

  • apkMeta.isSplitRequired (check here about an issue related to it) or "meta-data" with value of "com.android.vending.splits.required" set to true - > a base APK of split apks

  • "com.android.vending.splits.required" or "com.android.vending.splits" or "instantapps.clients.allowed" exist -> could be either a base apk or a standalone

  • Otherwise -> standalone APK.

Sample project:

https://github.com/AndroidDeveloperLB/apk-parser