MuntashirAkon/AppManager · error · IllegalStateException
Invalid App Manager version
Error message
Invalid App Manager version
What it means
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.
Source
Thrown at app/src/main/java/io/github/muntashirakon/AppManager/self/life/BuildExpiryChecker.java:132
@BuildType
private static int getBuildType() {
if (BuildConfig.DEBUG) {
return BUILD_TYPE_DEBUG;
}
String[] versionParts = BuildConfig.VERSION_NAME.split("-");
if (versionParts.length == 1) {
return BUILD_TYPE_STABLE;
}
String lastPart = versionParts[versionParts.length - 1];
switch (lastPart.substring(0, lastPart.length() - 2).toLowerCase(Locale.ROOT)) {
case "alpha":
return BUILD_TYPE_ALPHA;
case "beta":
return BUILD_TYPE_BETA;
case "rc":
return BUILD_TYPE_RC;
default:
throw new IllegalStateException("Invalid App Manager version");
}
}
}
View on GitHub (pinned to 0152f468fc)
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
Example fix
// before
default:
throw new IllegalStateException("Invalid App Manager version");
// after
default:
Log.w(TAG, "Unknown build type: " + type);
return BUILD_TYPE_STABLE; // or treat as unknown instead of crashing Defensive patterns
Strategy: validation
Validate before calling
String type = getBuildTypeString();
if (!"alpha".equals(type) && !"beta".equals(type) && !"rc".equals(type) && !"stable".equals(type)) {
throw new IllegalArgumentException("Unrecognized build type: " + type);
} Type guard
static boolean isKnownBuildType(String s) {
return "alpha".equals(s) || "beta".equals(s) || "rc".equals(s) || "stable".equals(s);
} Try / catch
try {
int bt = checker.getBuildType();
} catch (IllegalStateException e) {
// treat as unknown build; skip expiry checks or warn user
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: Installing a debug or custom-compiled build lacking the BuildConfig flavor marker; a version rename/upstream change altering flavor names; corrupted manifest metadata.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- The app has keystore items and KeyStore backup isn't enabled
- Unsupported mode ${mParentMode}
- "manifest" has duplicate "application" tags.
- Couldn't find any writable Obb dir
- Unknown density {densityName}
AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12).
Data as JSON: /api/errors/574e72083bce3c9f.
Report an issue: GitHub.