All Products
Search
Document Center

Mobile Testing - Deprecated:android_content_pm_PackageManager_NameNotFoundException

Last Updated:Feb 28, 2022

Problem description

This exception occurs when the name of the specified package, app, or component is not found.

Solution

This exception occurs when the name of the specified package, app, or component is not found. You must check the name of the dependent package, app, or component.

Sample code

    public static void startEmailIntent(Context context, String emailAddress) {
       try {
            Resources res = context.getPackageManager().
            getResourcesForApplication("com.android.launcher");
            res.getDisplayMetrics();
       } catch (NameNotFoundException e) {
                e.printStackTrace();
       }
    }

References