MuntashirAkon/AppManager · error · ApkFileException
Invalid package extension.
Error message
Invalid package extension.
What it means
Generic validation guard in the private ApkFile constructor: the URI's resolved MIME type is not in SUPPORTED_MIMES, so the source cannot be interpreted as any supported package format (apk, xapk, apks, apkm). The faulty input is apkUri/mimeType pointing at a non-package file or an unresolvable content URI.
Solutions
- Pass a URI whose MIME type is one of App Manager's supported package types (application/vnd.android.package-archive, vnd.apkm, xapk, apks)
- Verify the file is a real APK/bundle rather than a corrupted download before opening it
- If the type is legitimately missing from SUPPORTED_MIMES, extend the supported set instead of forcing the call
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at app/src/main/java/io/github/muntashirakon/AppManager/apk/ApkFile.java:210 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/2ff37fcd5985e525.
Report an issue: GitHub.
Appendix: source
Thrown at app/src/main/java/io/github/muntashirakon/AppManager/apk/ApkFile.java:210
private final File mCacheFilePath;
@Nullable
private ParcelFileDescriptor mFd;
@Nullable
private ZipFile mZipFile;
private boolean mClosed;
private ApkFile(@NonNull Uri apkUri, @Nullable String mimeType, int sparseArrayKey) throws ApkFileException {
mSparseArrayKey = sparseArrayKey;
Context context = ContextUtils.getContext();
Path apkSource = Paths.get(apkUri);
@NonNull String extension;
// Check type
if (mimeType == null) mimeType = apkSource.getType();
if (!SUPPORTED_MIMES.contains(mimeType)) {
Log.e(TAG, "Invalid mime: %s", mimeType);
// Check extension
if (!SUPPORTED_EXTENSIONS.contains(apkSource.getExtension())) {
throw new ApkFileException("Invalid package extension.");
}
extension = Objects.requireNonNull(apkSource.getExtension());
} else {
switch (mimeType) {
case "application/x-apks":
extension = "apks";
break;
case "application/xapk-package-archive":
extension = "xapk";
break;
case "application/vnd.apkm":
extension = "apkm";
break;
default:
extension = "apk";
break;
}
}View on GitHub (pinned to 0152f468fc)