{"record":{"id":"2ff37fcd5985e525","repo":"MuntashirAkon/AppManager","slug":"invalid-package-extension","errorCode":null,"errorMessage":"Invalid package extension.","messagePattern":"Invalid package extension\\.","errorType":"exception","errorClass":"ApkFileException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/github/muntashirakon/AppManager/apk/ApkFile.java","lineNumber":210,"sourceCode":"    private final File mCacheFilePath;\n    @Nullable\n    private ParcelFileDescriptor mFd;\n    @Nullable\n    private ZipFile mZipFile;\n    private boolean mClosed;\n\n    private ApkFile(@NonNull Uri apkUri, @Nullable String mimeType, int sparseArrayKey) throws ApkFileException {\n        mSparseArrayKey = sparseArrayKey;\n        Context context = ContextUtils.getContext();\n        Path apkSource = Paths.get(apkUri);\n        @NonNull String extension;\n        // Check type\n        if (mimeType == null) mimeType = apkSource.getType();\n        if (!SUPPORTED_MIMES.contains(mimeType)) {\n            Log.e(TAG, \"Invalid mime: %s\", mimeType);\n            // Check extension\n            if (!SUPPORTED_EXTENSIONS.contains(apkSource.getExtension())) {\n                throw new ApkFileException(\"Invalid package extension.\");\n            }\n            extension = Objects.requireNonNull(apkSource.getExtension());\n        } else {\n            switch (mimeType) {\n                case \"application/x-apks\":\n                    extension = \"apks\";\n                    break;\n                case \"application/xapk-package-archive\":\n                    extension = \"xapk\";\n                    break;\n                case \"application/vnd.apkm\":\n                    extension = \"apkm\";\n                    break;\n                default:\n                    extension = \"apk\";\n                    break;\n            }\n        }","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/AppManager/apk/ApkFile.java#L192-L228","documentation":"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.","triggerScenarios":"Thrown at app/src/main/java/io/github/muntashirakon/AppManager/apk/ApkFile.java:210 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5","analyzedAt":"2026-09-12T14:03:37.243Z","contentChangedAt":"2026-09-12T14:03:37.243Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}