MuntashirAkon/AppManager · error · ApkFileException

Could not cache the input file.

Error message

Could not cache the input file.

What it means

ApkFile could not materialize a readable cache copy or file descriptor of the input package: getFdFromUri opened the URI but no local, cacheable file could be derived from the descriptor, so later zip operations have nothing to work with. Faulty input: a content URI whose provider cannot back a seekable, cacheable file.

Solutions

  1. Copy the URI contents into the app's cache manually and open ApkFile from the local file instead
  2. Check storage permission and free space in the cache directory
  3. Ask the user to re-share the file via a local path or the FmProvider authority
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at app/src/main/java/io/github/muntashirakon/AppManager/apk/ApkFile.java:276 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/c41db8b23869988e. Report an issue: GitHub.

Appendix: source

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

                cacheFilePath = new File(apkUri.getPath());
            }
            if (!FmProvider.AUTHORITY.equals(apkUri.getAuthority())) {
                // Content scheme has a third-party authority
                try {
                    mFd = FileUtils.getFdFromUri(context, apkUri, "r");
                    cacheFilePath = FileUtils.getFileFromFd(mFd);
                } catch (FileNotFoundException e) {
                    throw new ApkFileException(e);
                } catch (SecurityException e) {
                    Log.e(TAG, e);
                }
            }
            if (cacheFilePath == null || !FileUtils.canReadUnprivileged(cacheFilePath)) {
                // Cache manually
                try {
                    mCacheFilePath = mFileCache.getCachedFile(apkSource);
                } catch (IOException | SecurityException e) {
                    throw new ApkFileException("Could not cache the input file.", e);
                }
            } else mCacheFilePath = cacheFilePath;
        }
        String packageName = null;
        // Check for splits
        if (extension.equals("apk")) {
            // Get manifest attributes
            ByteBuffer manifest = getManifestFromApk(mCacheFilePath);
            HashMap<String, String> manifestAttrs = getManifestAttributes(manifest);
            if (!manifestAttrs.containsKey(ATTR_PACKAGE)) {
                throw new IllegalArgumentException("Manifest doesn't contain any package name.");
            }
            packageName = manifestAttrs.get(ATTR_PACKAGE);
            mBaseEntry = new Entry(mCacheFilePath, manifest, manifestAttrs);
            mEntries.add(mBaseEntry);
        } else {
            try {
                mZipFile = new ZipFile(mCacheFilePath);

View on GitHub (pinned to 0152f468fc)