{"record":{"id":"574e72083bce3c9f","repo":"MuntashirAkon/AppManager","slug":"invalid-app-manager-version","errorCode":null,"errorMessage":"Invalid App Manager version","messagePattern":"Invalid App Manager version","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/github/muntashirakon/AppManager/self/life/BuildExpiryChecker.java","lineNumber":132,"sourceCode":"    @BuildType\n    private static int getBuildType() {\n        if (BuildConfig.DEBUG) {\n            return BUILD_TYPE_DEBUG;\n        }\n        String[] versionParts = BuildConfig.VERSION_NAME.split(\"-\");\n        if (versionParts.length == 1) {\n            return BUILD_TYPE_STABLE;\n        }\n        String lastPart = versionParts[versionParts.length - 1];\n        switch (lastPart.substring(0, lastPart.length() - 2).toLowerCase(Locale.ROOT)) {\n            case \"alpha\":\n                return BUILD_TYPE_ALPHA;\n            case \"beta\":\n                return BUILD_TYPE_BETA;\n            case \"rc\":\n                return BUILD_TYPE_RC;\n            default:\n                throw new IllegalStateException(\"Invalid App Manager version\");\n        }\n    }\n}\n","sourceCodeStart":114,"sourceCodeEnd":136,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/AppManager/self/life/BuildExpiryChecker.java#L114-L136","documentation":"BuildExpiryChecker.getBuildType maps the build flavor/type string (e.g. alpha, beta, rc) to a BUILD_TYPE constant; unknown strings hit the default branch and throw IllegalStateException 'Invalid App Manager version'. It guards against unrecognized or corrupted version metadata in the installed APK.","triggerScenarios":"Reading the build type from package/version metadata that is empty, renamed, or not one of 'alpha'|'beta'|'rc'|'stable'; running a self-built APK without the expected build-type property set.","commonSituations":"Installing a debug or custom-compiled build lacking the BuildConfig flavor marker; a version rename/upstream change altering flavor names; corrupted manifest metadata.","solutions":["Build the app with a recognized flavor/type (alpha, beta, rc, stable)","Ensure the build-type metadata (BuildConfig/flavor property) is included in the APK","Update App Manager to an official release whose version string is recognized","Add the unknown build type to the switch if it is a legitimate new flavor"],"exampleFix":"// before\ndefault:\n    throw new IllegalStateException(\"Invalid App Manager version\");\n// after\ndefault:\n    Log.w(TAG, \"Unknown build type: \" + type);\n    return BUILD_TYPE_STABLE; // or treat as unknown instead of crashing","handlingStrategy":"validation","validationCode":"String type = getBuildTypeString();\nif (!\"alpha\".equals(type) && !\"beta\".equals(type) && !\"rc\".equals(type) && !\"stable\".equals(type)) {\n    throw new IllegalArgumentException(\"Unrecognized build type: \" + type);\n}","typeGuard":"static boolean isKnownBuildType(String s) {\n    return \"alpha\".equals(s) || \"beta\".equals(s) || \"rc\".equals(s) || \"stable\".equals(s);\n}","tryCatchPattern":"try {\n    int bt = checker.getBuildType();\n} catch (IllegalStateException e) {\n    // treat as unknown build; skip expiry checks or warn user\n}","preventionTips":["Ensure every build flavor defines the build-type property","Keep BuildConfig flavor names in sync with the switch statement","Test release, debug, and self-built variants for version-metadata presence","Prefer a known-constant lookup with a safe default over throwing for new flavors"],"tags":["configuration","versioning","android"],"backgroundTag":"invalid-enum-value","analyzedSha":"0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5","analyzedAt":"2026-09-12T14:03:37.243Z","contentChangedAt":"2026-09-12T14:03:37.243Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}