{"record":{"id":"d37682853a7b5fc9","repo":"asLody/VirtualApp","slug":"pkg","errorCode":null,"errorMessage":"${pkg}","messagePattern":"\\$\\{pkg\\}","errorType":"exception","errorClass":"Resources.NotFoundException","httpStatus":null,"severity":"error","filePath":"VirtualApp/lib/src/main/java/com/lody/virtual/client/core/VirtualCore.java","lineNumber":563,"sourceCode":"\n    public boolean uninstallPackage(String pkgName) {\n        try {\n            return getService().uninstallPackage(pkgName);\n        } catch (RemoteException e) {\n            // Ignore\n        }\n        return false;\n    }\n\n    public Resources getResources(String pkg) throws Resources.NotFoundException {\n        InstalledAppInfo installedAppInfo = getInstalledAppInfo(pkg, 0);\n        if (installedAppInfo != null) {\n            AssetManager assets = mirror.android.content.res.AssetManager.ctor.newInstance();\n            mirror.android.content.res.AssetManager.addAssetPath.call(assets, installedAppInfo.apkPath);\n            Resources hostRes = context.getResources();\n            return new Resources(assets, hostRes.getDisplayMetrics(), hostRes.getConfiguration());\n        }\n        throw new Resources.NotFoundException(pkg);\n    }\n\n    public synchronized ActivityInfo resolveActivityInfo(Intent intent, int userId) {\n        ActivityInfo activityInfo = null;\n        if (intent.getComponent() == null) {\n            ResolveInfo resolveInfo = VPackageManager.get().resolveIntent(intent, intent.getType(), 0, userId);\n            if (resolveInfo != null && resolveInfo.activityInfo != null) {\n                activityInfo = resolveInfo.activityInfo;\n                intent.setClassName(activityInfo.packageName, activityInfo.name);\n            }\n        } else {\n            activityInfo = resolveActivityInfo(intent.getComponent(), userId);\n        }\n        if (activityInfo != null) {\n            if (activityInfo.targetActivity != null) {\n                ComponentName componentName = new ComponentName(activityInfo.packageName, activityInfo.targetActivity);\n                activityInfo = VPackageManager.get().getActivityInfo(componentName, 0, userId);\n                intent.setComponent(componentName);","sourceCodeStart":545,"sourceCodeEnd":581,"githubUrl":"https://github.com/asLody/VirtualApp/blob/666fefcb5d3f39cc944001c3457c38ffd6544c87/VirtualApp/lib/src/main/java/com/lody/virtual/client/core/VirtualCore.java#L545-L581","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nResources res = core.getResources(\"com.example.plugin\"); // not installed\n// after\nInstalledAppInfo info = core.getInstalledAppInfo(\"com.example.plugin\", 0);\nResources res = info != null ? core.getResources(\"com.example.plugin\") : null;","handlingStrategy":"validation","validationCode":"InstalledAppInfo info = VirtualCore.get().getInstalledAppInfo(pkg, 0);\nif (info == null) throw new IllegalStateException(\"Package not installed in VA: \" + pkg);","typeGuard":null,"tryCatchPattern":"try { Resources r = core.getResources(pkg); } catch (Resources.NotFoundException e) { /* fall back to host resources or prompt install */ }","preventionTips":["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"],"tags":["android","resources","package-not-found","plugin"],"backgroundTag":"resource-not-found","analyzedSha":"666fefcb5d3f39cc944001c3457c38ffd6544c87","analyzedAt":"2026-09-09T11:09:01.694Z","contentChangedAt":"2026-09-09T11:09:01.694Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}