MuntashirAkon/AppManager · error · ApkFileException

IOException

Error message

IOException

What it means

When the source resolves to an .apkm package, ApkFile probes it with FileUtils.isZip to detect a DRM-free APKM; the zip sniffing threw IOException (unreadable file/URI, I/O failure) or SecurityException (no read permission), so construction aborts early with ApkFileException. The input at fault is the apkUri content stream for the apkm file.

Solutions

  1. Check the URI is readable (persistable/read permission granted for content URIs) before constructing ApkFile
  2. Re-download or re-export the APKM file if it is truncated or corrupted
  3. Catch ApkFileException at the call site and surface the cause to the user
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at app/src/main/java/io/github/muntashirakon/AppManager/apk/ApkFile.java:237 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at app/src/main/java/io/github/muntashirakon/AppManager/apk/ApkFile.java:237

                    extension = "xapk";
                    break;
                case "application/vnd.apkm":
                    extension = "apkm";
                    break;
                default:
                    extension = "apk";
                    break;
            }
        }
        if (extension.equals("apkm")) {
            try {
                if (FileUtils.isZip(apkSource)) {
                    // DRM-free APKM file, mark it as APKS
                    // FIXME(#227): Give it a special name and verify integrity
                    extension = "apks";
                }
            } catch (IOException | SecurityException e) {
                throw new ApkFileException(e);
            }
        }
        // Cache the file or use file descriptor for non-APKM files
        if (extension.equals("apkm")) {
            // Convert to APKS
            try {
                mCacheFilePath = mFileCache.createCachedFile("apks");
                try (ParcelFileDescriptor inputFD = FileUtils.getFdFromUri(context, apkUri, "r");
                     OutputStream outputStream = new FileOutputStream(mCacheFilePath)) {
                    UnApkm unApkm = new UnApkm(context, UN_APKM_PKG);
                    unApkm.decryptFile(inputFD, outputStream);
                }
            } catch (IOException | RemoteException e) {
                throw new ApkFileException(e);
            }
        } else {
            // Open file descriptor if necessary
            File cacheFilePath = null;

View on GitHub (pinned to 0152f468fc)