I have tried the following source code in the 'Android R' emulator, and it is throwing PackageManager.NameNotFoundException
.
getPackageInfo("com.mycompany.mypackage",0);
Is anybody facing the same issue ? Any idea if this API will be deprecated, if some extra permissions are required starting from 'Android R', or if it is a simple issue in the emulator ?
Based on CommonsWare answer, I have added
<queries>
<package android:name="com.mycompany.mypackage" />
</queries>
To the Android manifest file, and the issue has gone.