Sideloading Android APKS Files Using APKSInstaller Utility

Ian Hatton -
3 MIN READ

Overview

This article details a method to install APKS files via sideloading them in a StageNow profile . APKS files are split APK files containing multiple component files which are combined into a single file.  

Detail

The traditional way to sideload an application without using Play is to create a single APK created via a backup utility such as  ‘App Backup and Restore’ . This has worked previously for almost all apps posted on Play . Recently we noticed that some apps backed up this way will either fail install via ADB with an error such as ‘Failure [INSTALL_FAILED_VERIFICATION_FAILURE]’ or will install and then fail without an error when run on the device.

The reason for this is that the app has been split into multiple APK’s ( https://developer.android.com/studio/build/configure-apk-splits , source code here: https://forum.xda-developers.com/android/software-hacking/guide-apk-bundle-installation-t3934631 ) so the single APK contains only part of the complete app.  Other Enterprise apps which are in the APKS format include the following:

SumUp Payment Client https://play.google.com/store/apps/details?id=com.kaching.merchant&hl=en

Anyline OCR

https://play.google.com/store/apps/details?id=io.anyline.examples.store

RawBT Print Driver

https://play.google.com/store/apps/details?id=ru.a402d.rawbtprinter

 

Example Installation

https://play.google.com/store/apps/details?id=com.waitrose.groceries

Taking the Waitrose app above as an example , we can compare the size of the APK file created by the ‘App Backup and Restore’ utility with the APKS file created by an equivalent Split APK backup utility (
Split APKs Installer (SAI)  https://play.google.com/store/apps/details?id=com.aefyr.sai )

 

The APKS file is almost double the size of the single APK and contains the missing parts of the app which are required in order to allow it to install and run correctly when sideloaded.  

Using the APKS file, we can install the full application via an unofficial utility developed by James Swinton (Zebra EMEA) named ApksInstaller. This utility uses the Google PackageInstaller API (https://developer.android.com/reference/android/content/pm/PackageInstaller ) to install the APKS file and has an intent inferface so that it can be included in a StageNow profile for installation of any APKS file.

For demonstration , the internet-hosted StageNow package which installs the Waitrose APKS via this utility is provided below . Scan this barcode on a Zebra device with a pre-configured internet connection to test . 

stagenow

Note that a couple of manual confirmations are required during installation for permissions which are not able to be pre-granted as shown in the screenshots below:

Enable Allow from this source

 

Confirm Install

 

APKS install in progress

The XML required to launch the APKS installer app is as follows:

 

   <wap-provisioningdoc>
  <!--SettingID=47-->
  <characteristic version="8.3" type="Intent">
    <parm name="Action" value="StartActivity" />
    <parm name="ActionName" value="com.zebra.jamesswinton.splitapkpackageinstaller.INSTALL_PACKAGE" />
    <parm name="Package" value="com.zebra.jamesswinton.apksinstaller" />
    <parm name="Class" value="com.zebra.jamesswinton.apksinstaller.MainActivity" />
    <characteristic type="Extra">
      <parm name="ExtraType" value="string" />
      <parm name="ExtraName" value="apks_path" />
      <parm name="ExtraValue" value="/sdcard/Waitrose_com,waitrose,groceries_2,3,1,2288.apks" />
    </characteristic>
  </characteristic>
</wap-provisioningdoc>

 

The ExtraValue specifies the path and filename of the APKS file to install. The APKS installer utility is available here: http://airsetup.uk/airsetup.uk/airbeam/zebra/2020/apks_installer/APKSIn…;

Note that this utility is keyed to Zebra hardware and will not run on other manufacturer’s devices. Full XML used in the Waitrose sample profile is available here: 

http://airsetup.uk/airsetup.uk/airbeam/zebra/2020/apks_installer/waitro…

Ian Hatton

Zebra EMEA

(Updated) Nov 2021

 

 

profile

Ian Hatton

Please register or login to post a reply

Replies