MuntashirAkon/AppManager · error · IllegalArgumentException

No splits selected.

Error message

No splits selected.

What it means

PackageInstallerViewModel.getSelectedSplitsForInstallation() returns the user-selected splits for the package being installed. For a split APK (APK suite), the selection must contain at least one entry; if mSelectedSplits is empty an IllegalArgumentException is thrown because a split install cannot proceed with zero splits.

Source

Thrown at app/src/main/java/io/github/muntashirakon/AppManager/apk/installer/PackageInstallerViewModel.java:261

                    UserHandleHidden.USER_ALL, false));
        });
    }

    @Nullable
    public PackageParseResult getCurrentPackage() {
        return mCurrentPackage;
    }

    public Set<String> getSelectedSplits() {
        return mSelectedSplits;
    }

    @NonNull
    public ArrayList<String> getSelectedSplitsForInstallation() {
        ApkFile apkFile = Objects.requireNonNull(mCurrentPackage).apkFile;
        if (apkFile.isSplit()) {
            if (mSelectedSplits.isEmpty()) {
                throw new IllegalArgumentException("No splits selected.");
            }
            return new ArrayList<>(mSelectedSplits);
        }
        return new ArrayList<>(Collections.singletonList(apkFile.getBaseEntry().id));
    }

    @WorkerThread
    @NonNull
    private PackageParseResult loadPackageInfo(@NonNull ApkQueueItem apkQueueItem) throws Throwable {
        ApkSource apkSource;
        ApkFile apkFile = null;
        try {
            PackageInfo installedPackageInfo = null;
            if (apkQueueItem.isInstallExisting()) {
                String packageName = apkQueueItem.getPackageName();
                if (packageName == null) {
                    throw new IllegalArgumentException("Package name not set for install-existing.");
                }

View on GitHub (pinned to 0152f468fc)

Solutions

  1. Ensure the split-selection step completes and populates mSelectedSplits (at minimum the base split) before calling getSelectedSplitsForInstallation()
  2. Guard the call: only invoke it when apkFile.isSplit() is false or mSelectedSplits is non-empty
  3. In the UI, disable the install button until at least one split is selected
  4. Catch IllegalArgumentException and route the user back to the split-selection screen

Example fix

// before
vm.startInstall(); // throws if no splits selected for a split APK
// after
if (!vm.getCurrentPackage().apkFile.isSplit() || vm.getSelectedSplits().isEmpty()) {
    openSplitSelectionScreen();
} else {
    vm.startInstall();
}
Defensive patterns

Strategy: validation

Validate before calling

ApkFile apkFile = vm.getCurrentPackage().apkFile;
if (apkFile.isSplit() && vm.getSelectedSplits().isEmpty()) {
    // do not call getSelectedSplitsForInstallation(); open split picker instead
}

Type guard

boolean canInstall(ApkFile apkFile, Set<String> selected) {
    return !apkFile.isSplit() || !selected.isEmpty();
}

Try / catch

try {
    List<String> splits = vm.getSelectedSplitsForInstallation();
} catch (IllegalArgumentException e) {
    openSplitSelectionScreen();
}

Prevention

When it happens

Trigger: Calling getSelectedSplitsForInstallation() after ApkFile.isSplit() is true but before the user (or caller) has selected any splits in mSelectedSplits — e.g. invoking install/start-install directly after loading a split APK without going through the split-selection screen.

Common situations: Automated flows that call the install method without the split-selection dialog; a UI bug that allows confirming with no checkboxes selected; ViewModel state reset (process death/config change) clearing mSelectedSplits before install is invoked.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12). Data as JSON: /api/errors/54fac5e449100a13. Report an issue: GitHub.