asLody/VirtualApp · error · Resources.NotFoundException
${pkg}
Error message
${pkg} What it means
This Resources.NotFoundException is thrown by the method that builds plugin Resources: when no InstalledAppInfo exists for the requested package, the library cannot add the plugin APK's asset path to a new AssetManager and throws NotFoundException(pkg) naming the missing package.
Solutions
- Verify the package is installed: VirtualCore.get().getInstalledAppInfo(pkg, 0) != null before requesting its resources
- Install the plugin first via VirtualCore.get().installPackage(apkPath) and use the returned InstalledAppInfo
- Check the exact package name (case, suffixes) matches the installed plugin
Example fix
// before
Resources res = core.getResources("com.example.plugin"); // not installed
// after
InstalledAppInfo info = core.getInstalledAppInfo("com.example.plugin", 0);
Resources res = info != null ? core.getResources("com.example.plugin") : null; Defensive patterns
Strategy: validation
Validate before calling
InstalledAppInfo info = VirtualCore.get().getInstalledAppInfo(pkg, 0);
if (info == null) throw new IllegalStateException("Package not installed in VA: " + pkg); Try / catch
try { Resources r = core.getResources(pkg); } catch (Resources.NotFoundException e) { /* fall back to host resources or prompt install */ } Prevention
- Always install the plugin (installPackage) and await completion before touching its resources
- Validate package names against getInstalledAppInfo
- Handle uninstalled-plugin states in UI before launching
When it happens
Trigger: Requesting resources for a package that was never installed into the virtual environment (getPackageInfo/install not done), or passing a misspelled/wrong package name to the resources lookup API.
Common situations: Launching or loading a plugin before awaiting the asynchronous install; stale package name after the plugin was uninstalled from the VA container; hard-coded package string mismatch.
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
- Unable to create application
- Unable to start receiver
- VirtualCore.startup() must called in main thread.
- Initializer = NULL
- connection is null
AI-assisted analysis of asLody/VirtualApp@666fefcb5d (2026-09-09).
Data as JSON: /api/errors/d37682853a7b5fc9.
Report an issue: GitHub.
Appendix: source
Thrown at VirtualApp/lib/src/main/java/com/lody/virtual/client/core/VirtualCore.java:563
public boolean uninstallPackage(String pkgName) {
try {
return getService().uninstallPackage(pkgName);
} catch (RemoteException e) {
// Ignore
}
return false;
}
public Resources getResources(String pkg) throws Resources.NotFoundException {
InstalledAppInfo installedAppInfo = getInstalledAppInfo(pkg, 0);
if (installedAppInfo != null) {
AssetManager assets = mirror.android.content.res.AssetManager.ctor.newInstance();
mirror.android.content.res.AssetManager.addAssetPath.call(assets, installedAppInfo.apkPath);
Resources hostRes = context.getResources();
return new Resources(assets, hostRes.getDisplayMetrics(), hostRes.getConfiguration());
}
throw new Resources.NotFoundException(pkg);
}
public synchronized ActivityInfo resolveActivityInfo(Intent intent, int userId) {
ActivityInfo activityInfo = null;
if (intent.getComponent() == null) {
ResolveInfo resolveInfo = VPackageManager.get().resolveIntent(intent, intent.getType(), 0, userId);
if (resolveInfo != null && resolveInfo.activityInfo != null) {
activityInfo = resolveInfo.activityInfo;
intent.setClassName(activityInfo.packageName, activityInfo.name);
}
} else {
activityInfo = resolveActivityInfo(intent.getComponent(), userId);
}
if (activityInfo != null) {
if (activityInfo.targetActivity != null) {
ComponentName componentName = new ComponentName(activityInfo.packageName, activityInfo.targetActivity);
activityInfo = VPackageManager.get().getActivityInfo(componentName, 0, userId);
intent.setComponent(componentName);View on GitHub (pinned to 666fefcb5d)