I've a very simply function like following:
public static boolean isAppInstalled(String packageName) {
PackageManager pm = MainApp.get().getPackageManager();
try {
pm.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES);
return true;
} catch (PackageManager.NameNotFoundException e) {
return false;
}
}
Sometimes this crashes at the line getPackageInfo
with following stacktrace:
java.lang.RuntimeException: Package manager has died
at android.app.ApplicationPackageManager.getPackageInfo(ApplicationPackageManager.java:151)
... code in my app => getPackageInfo line above ...
Caused by: android.os.DeadObjectException: Transaction failed on small parcel; remote process probably died
at android.os.BinderProxy.transactNative(Native Method)
at android.os.BinderProxy.transact(Binder.java:505)
at android.content.pm.IPackageManager$Stub$Proxy.getPackageInfo(IPackageManager.java:2151)
at android.app.ApplicationPackageManager.getPackageInfo(ApplicationPackageManager.java:145)
...
Any ideas why this can happen? I thought things like this only happen if an app is installed / deinstalled just at the same time, but I have an user who can repeat this and always get's this exception.