Skip to content

NullPointerException in LeakCanaryInternals.isInServiceProcess() #449

Closed

Description

It looks like ActivityManager.getRunningAppProcesses can return null: http://developer.android.com/reference/android/app/ActivityManager.html#getRunningAppProcesses()

LeakCanaryInternals.isInServiceProcess() doesn't seem to check for this case.

Stack trace excerpt:

java.lang.RuntimeException: Unable to create application [...]: java.lang.NullPointerException: Attempt to invoke interface method 'java.util.Iterator java.util.List.iterator()' on a null object reference
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4710)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'java.util.Iterator java.util.List.iterator()' on a null object reference
at com.squareup.leakcanary.internal.LeakCanaryInternals.isInServiceProcess(LeakCanaryInternals.java:117)
at com.squareup.leakcanary.LeakCanary.isInAnalyzerProcess(LeakCanary.java:237)
at com.squareup.leakcanary.LeakCanary.install(LeakCanary.java:77)
at com.squareup.leakcanary.LeakCanary.install(LeakCanary.java:42)
[...]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions