10

Background

Sometimes when you backup some APK file of an app, you'd notice that they consist of multiple APK files, meaning split APK files (AKA app-bundle).

The problem

I want to know, when someone sends the user an APK file, if indeed it's a standalone one, or is a part of split APK files. The reason is a different procedure and even a warning of such a thing, because split APK files are not really meant to be installed as normal ones.

What I've tried

Given PackageManager class (here), I couldn't find a way for getPackageArchiveInfo to get this kind of information.

There is splitNames and splitRevisionCodes , but both are just null.

My question

Is it possible, given a single APK file, to check if it's a part of multiple split APK files?


EDIT: so thanks to here, I've found how to do it for the main APK of the split APK files ("base.APK") :

    val packageInfo = pm.getPackageArchiveInfo(apkPath, PackageManager.GET_META_DATA)
    val isSplit = packageInfo.applicationInfo.metaData.getBoolean("com.android.vending.splits.required", false)

But, as for the rest of the split apk files, using getPackageArchiveInfo on them will just return null. I can't find how to parse the manifest of them to find the "split" attribute.

So my question now is:

Given the rest of the split APK files, how can I parse them to check they are indeed split APK files , which belong to the base.APK file?

android developer
  • 114,585
  • 152
  • 739
  • 1,270

0 Answers0