设置targetSdkVersion
为30
(Android 11)后,我在处理我知道存在的包android.content.pm.PackageManager$NameNotFoundException
时得到了。packageManager.getPackageInfo(packageName, PackageManager.GET_PERMISSIONS)
堆栈跟踪如下:
android.content.pm.PackageManager$NameNotFoundException: com.google.android.apps.maps
at android.app.ApplicationPackageManager.getPackageInfoAsUser(ApplicationPackageManager.java:202)
at android.app.ApplicationPackageManager.getPackageInfo(ApplicationPackageManager.java:174)