A Comprehensive Guide to Manually Installing Split APKs with ADB
Installing split APKs or App Bundles on Android can be intricate and, at times, necessary. This guide offers a detailed, step-by-step approach to manually install these files, aiming to clarify the process and address common issues.
What Are Split APKs?
Traditionally, Android applications are distributed as a single APK file. However, the advent of App Bundles has revolutionized this model. App Bundles break an app into several APK files, each tailored for different device configurations. For instance, devices with smaller screens receive only essential resources, while those with larger screens are provided with additional assets. Although this approach reduces the app’s size, it complicates manual installations, especially when sideloading.
Why Use App Bundles?
The adoption of App Bundles serves purposes beyond simple size reduction. By segmenting apps into multiple APKs, Google may be encouraging users to use the Play Store, given that manually installing these fragmented files can be challenging. Each APK within a bundle is designed to work together, but when installed manually, the Android system may not detect all components, potentially resulting in incomplete installations.
Starting August 2021, new apps must be published using the Android App Bundle on Google Play. Additionally, new apps larger than 200 MB must utilize either Play Feature Delivery or Play Asset Delivery. From June 2023, all new and existing TV apps are also required to be published as App Bundles.
Preparing for Manual Installation
There are various methods for installing multiple APKs. For instance, you can use the ADB command to install multiple APKs simultaneously:
1 | adb install-multiple /path/to/your/APKs |
This guide, however, focuses on a programmatic approach similar to what SAI (Split APK Installer) utilizes. You can also create your own installer for managing multiple APKs if necessary.
To manually install split APKs, ensure that all required APK files are transferred to your device. Although you can place them in any directory, this guide assumes they are located in the Download folder. Follow these steps to set up the installation:
- Start ADB and Open a Shell: Connect your Android device to your computer and initiate an ADB shell session.
1
adb shell
- Navigate to the File Directory: Change the directory to where the APK files are stored.
1
cd /sdcard/Download # or the appropriate folder on your device
- List the APK Files: Display all APK files and their sizes, which is essential for the installation.
1
ls -l
Performing the Installation
The installation process involves several steps. These instructions apply to Android versions before Nougat. For newer versions, adjust the syntax as necessary.
Create an Installation Session: Begin by creating a new session with the total size of all APK files.
1
pm install-create -S TOTAL_SIZE_OF_ALL_APKS
You will receive a session ID for use in the subsequent steps.
Stage the APK Files: Each APK must be staged individually. Start with the base APK, but the order can vary. Provide the APK size, session ID, index, and path.
1
pm install-write -S APK_SIZE SESSION_ID INDEX PATH
Repeat this command for each APK file to be installed.
Commit the Installation: Finalize the installation by committing the session.
1
pm install-commit SESSION_ID
Example Installation
Consider an app named com.disney.disneyplus
with multiple APK files: a base APK, several language-specific APKs, and a high-resolution screen module. The files might be listed as follows:
1 | -rw-rw-rw-@ 1 ChauyanWang staff 58 Aug 15 23:00 APKM_installer.url |
To install this app, select the base APK, a language module, and a resolution module. Calculate the total size (25,083,703 bytes) and start a new installation session:
1 | pm install-create -S 25083703 |
After obtaining the installation session ID (assuming it’s 1234), stage each APK file:
1 | pm install-write -S 23346094 1234 0 base.apk |
Finalize the installation by committing the session:
1 | pm install-commit 1234 |
Final Thoughts
Manually installing split APK files demands careful attention but offers a practical solution when traditional methods are unavailable. By following this guide, you can effectively manage App Bundles and ensure successful installation on your Android device. This approach provides enhanced control over the installation process, particularly for fragmented application files.