MuntashirAkon/AppManager · error · PackageManager.NameNotFoundException
${packageName}
Error message
${packageName} What it means
Thrown by setDomainVerificationLinkHandlingAllowed when the Android framework's domain verification service reports errorCode 1, indicating the given package does not exist (or is not visible to the caller) for domain-verification purposes. The compat layer maps that service-specific error to PackageManager.NameNotFoundException, using the package name (or the framework's own message when packageName is null).
Source
Thrown at app/src/main/java/io/github/muntashirakon/AppManager/compat/DomainVerificationManagerCompat.java:42
return getDomainVerificationManager().getDomainVerificationUserState(packageName, userId);
} catch (Throwable ignore) {
}
return null;
}
@RequiresPermission(ManifestCompat.permission.UPDATE_DOMAIN_VERIFICATION_USER_SELECTION)
public static void setDomainVerificationLinkHandlingAllowed(String packageName, boolean allowed, int userId)
throws RemoteException, PackageManager.NameNotFoundException {
try {
getDomainVerificationManager().setDomainVerificationLinkHandlingAllowed(packageName, allowed, userId);
} catch (ServiceSpecificException e) {
int serviceSpecificErrorCode = e.errorCode;
if (packageName == null) {
packageName = e.getMessage();
}
if (serviceSpecificErrorCode == 1) {
throw new PackageManager.NameNotFoundException(packageName);
}
throw e;
}
}
public static IDomainVerificationManager getDomainVerificationManager() {
return IDomainVerificationManager.Stub.asInterface(ProxyBinder.getService(Context.DOMAIN_VERIFICATION_SERVICE));
}
}
View on GitHub (pinned to 0152f468fc)
Solutions
- Verify the package is installed and visible before calling (pm.getPackageInfo in a try-catch, or getApplicationInfo).
- Add a <queries> entry in AndroidManifest.xml so the target package is visible to your app.
- Catch PackageManager.NameNotFoundException around the call and handle the missing-package case.
- Double-check the userId/packageName pair (e.g. profile user vs main user).
Example fix
// before
compat.setDomainVerificationLinkHandlingAllowed(pkg, userId, true);
// after
try {
compat.setDomainVerificationLinkHandlingAllowed(pkg, userId, true);
} catch (PackageManager.NameNotFoundException e) {
// package not installed / not visible; skip or inform user
} Defensive patterns
Strategy: try-catch
Validate before calling
try {
pm.getPackageInfoAsUser(packageName, 0, userId);
} catch (PackageManager.NameNotFoundException e) {
// skip domain verification call
} Type guard
boolean isInstalled(String pkg, int userId) {
try { pm.getPackageInfoAsUser(pkg, 0, userId); return true; }
catch (PackageManager.NameNotFoundException e) { return false; }
} Try / catch
try {
compat.setDomainVerificationLinkHandlingAllowed(pkg, userId, true);
} catch (PackageManager.NameNotFoundException e) {
Log.w(TAG, "Package not available for domain verification: " + pkg);
} Prevention
- Check installation/visibility before calling
- Declare <queries> entries for target packages
- Validate userId (profile vs main)
When it happens
Trigger: Calling setDomainVerificationLinkHandlingAllowed(packageName, userId, allowed) with a packageName that is not installed, has been uninstalled, or is not visible due to package visibility filtering; also when the underlying IDomainVerificationManager call throws an AndroidException with errorCode 1.
Common situations: Querying a package right after uninstall; missing <queries> declaration so the package is filtered out on Android 11+; targeting a work-profile user where the package is absent; typos in the package name.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Could not retrieve info for package %s with flags 0x%X for u
- Package ${packageName} not found.
- Unknown package: ...
- "manifest" has duplicate "application" tags.
- Couldn't find any writable Obb dir
AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12).
Data as JSON: /api/errors/1186bab73520de6e.
Report an issue: GitHub.