MuntashirAkon/AppManager · error · RemoteException
Unknown package: ...
Error message
Unknown package: ...
What it means
getInstallSourceInfo fetches the installer package name via IPackageManager. For unknown packages the framework throws IllegalArgumentException whose message starts with "Unknown package:"; the compat layer rethrows it as a RemoteException carrying the original message so callers can distinguish it from other failures.
Source
Thrown at app/src/main/java/io/github/muntashirakon/AppManager/compat/PackageManagerCompat.java:330
@SuppressWarnings("deprecation")
@NonNull
public static InstallSourceInfoCompat getInstallSourceInfo(@NonNull String packageName, @UserIdInt int userId)
throws RemoteException {
IPackageManager pm = getPackageManager();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
return new InstallSourceInfoCompat(pm.getInstallSourceInfo(packageName, userId));
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
return new InstallSourceInfoCompat(pm.getInstallSourceInfo(packageName));
}
String installerPackageName = null;
try {
installerPackageName = getPackageManager().getInstallerPackageName(packageName);
} catch (IllegalArgumentException e) {
String message = e.getMessage();
if (message != null && message.startsWith("Unknown package:")) {
throw new RemoteException(message);
}
}
return new InstallSourceInfoCompat(installerPackageName);
}
@Nullable
public static Intent getLaunchIntentForPackage(@NonNull String packageName, @UserIdInt int userId) {
Context context = ContextUtils.getContext();
if (userId == UserHandleHidden.myUserId()) {
PackageManager pm = context.getPackageManager();
return Utils.isTv(context)
? pm.getLeanbackLaunchIntentForPackage(packageName)
: pm.getLaunchIntentForPackage(packageName);
}
UserHandle userHandle = Users.getUserHandle(userId);
if (userHandle == null) {
// No supported user present
return null;View on GitHub (pinned to 0152f468fc)
Solutions
- Catch RemoteException around getInstallSourceInfo and treat it as package-not-found.
- Validate the package is installed before querying its install source.
- Parse the message (startsWith "Unknown package:") if you need to distinguish this case.
- Use getInstalledPackages to build the set of valid package names first.
Example fix
// before
InstallSourceInfoCompat src = PackageManagerCompat.getInstallSourceInfo(pkg);
// after
InstallSourceInfoCompat src;
try {
src = PackageManagerCompat.getInstallSourceInfo(pkg);
} catch (RemoteException e) {
src = null; // unknown package
} Defensive patterns
Strategy: try-catch
Validate before calling
boolean known;
try { pm.getPackageInfoAsUser(pkg, 0, userId); known = true; }
catch (PackageManager.NameNotFoundException e) { known = false; } Try / catch
try {
InstallSourceInfoCompat src = PackageManagerCompat.getInstallSourceInfo(pkg);
} catch (RemoteException e) {
if (e.getMessage() != null && e.getMessage().startsWith("Unknown package:")) {
// handle unknown package
}
} Prevention
- Query install source only for installed packages
- Distinguish RemoteException messages by prefix
- Keep a cached set of installed package names
When it happens
Trigger: Calling getInstallSourceInfo(packageName) for a package that is not installed (or not known to the system server), causing the underlying binder call to throw IllegalArgumentException("Unknown package: ...").
Common situations: Checking install source right after uninstall; malformed/typo package names; querying packages from another profile where they don't exist.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
- ${packageName}
- Could not retrieve info for package %s with flags 0x%X for u
- Package ${packageName} not found.
- IOException(REMOTE_ERR_MSG, throwable)
- IOException(remoteException)
AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12).
Data as JSON: /api/errors/9a9420f095559be8.
Report an issue: GitHub.