PackageManager died - DeadObjectException - Transaction failed on small parcel
Asked Answered
W

2

6

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.

Workbench answered 21/10, 2018 at 13:18 Comment(2)
I have similar problem. you got any solution ?Proteolysis
I too have to same problem. Did you guys found a fixThrasher
E
0

I am seeing the same problem, but only on Android 6. I am trying to see if adding the PackageManager.GET_META_DATA flag helps. It was suggested in the comments in this similar question: GetPackageInfo results in DeadObjectException

Excrescent answered 28/1, 2022 at 18:55 Comment(0)
C
-1

Restrat your Mobile Phone after that;

  1. Clean project
  2. Rebuild Projet
  3. Compile Project
Cheeky answered 17/5, 2019 at 6:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.