Android-job: JobStatus.getUid()' on a null object reference

Created on 16 Oct 2016  路  30Comments  路  Source: evernote/android-job

Not sure if actually an issue with this lib or maybe gcm.

Cant't reproduce but seems to happen after JobManager.instance().cancelAllForTag.
Up to now only appeared three times (2x Samsung 5.0, 1x Huawai 6.0) within the last week (having a few thousand active users per day).

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'int com.android.server.job.controllers.JobStatus.getUid()' on a null object reference
       at android.os.Parcel.readException(Parcel.java:1552)
       at android.os.Parcel.readException(Parcel.java:1499)
       at android.app.job.IJobCallback$Stub$Proxy.jobFinished(IJobCallback.java:167)
       at android.app.job.JobService$JobHandler.handleMessage(JobService.java:147)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:135)
       at android.app.ActivityThread.main(ActivityThread.java:5910)
       at java.lang.reflect.Method.invoke(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:372)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1405)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1200)

Most helpful comment

Seeing the same issue here

java.lang.NullPointerException:
at android.os.Parcel.readException (Parcel.java:1552)
at android.os.Parcel.readException (Parcel.java:1499)
at android.app.job.IJobCallback$Stub$Proxy.jobFinished (IJobCallback.java:167)
at android.app.job.JobService$JobHandler.handleMessage (JobService.java:147)
at android.os.Handler.dispatchMessage (Handler.java:102)
at android.os.Looper.loop (Looper.java:135)
at android.app.ActivityThread.main (ActivityThread.java:5422)
at java.lang.reflect.Method.invoke (Native Method)
at java.lang.reflect.Method.invoke (Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:914)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:707)

All 30 comments

I haven't seen this before. Looks more like an issue with the JobScheduler and you could file a ticket at AOSP. I don't think we can do anything here.

I'm not sure. The library calls jobFinished() asynchronously on a background thread. That's different than what the bug report states.

Maybe it was already fixed? https://code.google.com/p/android/issues/detail?id=170814 Do you use the JobScheduler at other places?

I don't think so as I only added this library about ten days ago, already using the latest available version.

It looks like I can't do anything. This is a platform bug and there is no way to catch it. Do you have an idea?

Closing because of inactivity

I have the same issues

I have the same issues

That's a bug in the Android platform. You better file a bug here: https://code.google.com/p/android/issues/list I'm also not aware of any workaround :(

Is the explaination mentioned here relevant ? : https://github.com/yigit/android-priority-jobqueue/issues/157#issuecomment-222320643

No, that's a completely different project.

different project, but same android issue and bug. I'm wondering if their workaround (mentioned in the comment) can be applied as a workaround here.

Has anyone found a resolution for this ?

Seeing the same issue here

java.lang.NullPointerException:
at android.os.Parcel.readException (Parcel.java:1552)
at android.os.Parcel.readException (Parcel.java:1499)
at android.app.job.IJobCallback$Stub$Proxy.jobFinished (IJobCallback.java:167)
at android.app.job.JobService$JobHandler.handleMessage (JobService.java:147)
at android.os.Handler.dispatchMessage (Handler.java:102)
at android.os.Looper.loop (Looper.java:135)
at android.app.ActivityThread.main (ActivityThread.java:5422)
at java.lang.reflect.Method.invoke (Native Method)
at java.lang.reflect.Method.invoke (Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:914)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:707)

I am also still getting this crash with com.evernote:android-job:1.2.6 and Android 6

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'int com.android.server.job.controllers.JobStatus.getUid()' on a null object reference

Same issue here. Happening all the time.

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'int com.android.server.job.controllers.JobStatus.getUid()' on a null object reference at android.os.Parcel.readException(Parcel.java:1562) at android.os.Parcel.readException(Parcel.java:1509) at android.app.job.IJobCallback$Stub$Proxy.jobFinished(IJobCallback.java:168) at android.app.job.JobService$JobHandler.handleMessage(JobService.java:147) at android.os.Handler.dispatchMessage(Handler.java:111) at android.os.Looper.loop(Looper.java:210) at android.app.ActivityThread.main(ActivityThread.java:5833) at java.lang.reflect.Method.invoke(Method.java) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1113) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:879)

Has anyone found a work around for this? It looks like Google is not fixing this, as several people have reported this bug, but they've closed it.

I am too facing the same issue. Is it fixed ?

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'int com.android.server.job.controllers.JobStatus.getUid()' on a null object reference
at android.os.Parcel.readException(Parcel.java:1552)
at android.os.Parcel.readException(Parcel.java:1499)
at android.app.job.IJobCallback$Stub$Proxy.jobFinished(IJobCallback.java:167)
at android.app.job.JobService$JobHandler.handleMessage(JobService.java:147)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5422)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:914)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:707)

I am facing this project nearly, How to fix it

Handling that NPE was only option that I found. So surround it with try-catch.

Handling that NPE was only option that I found. So surround it with try-catch.

How did you syrround it with try-catch, could you show your implementation, please?

I did it as follows.

@Override
    public boolean onStartJob(JobParameters jobParameters) {
        // TODO Add your task

        // Should be protected to avoid crash in a device where call to jobId() results in NPE. Seems platform error
        try {
            jobFinished(jobParameters, true);
        } catch (NullPointerException ignored) {
        }
}

i use WorkManager, i also found this uncaught exception:
java.lang.NullPointerException: Attempt to invoke virtual method 'int com.android.server.job.controllers.JobStatus.getUid()' on a null object reference

01-25 09:15:47.495 E/AndroidRuntime(15729): at android.os.Parcel.readException(Parcel.java:1636)

01-25 09:15:47.495 E/AndroidRuntime(15729): at android.os.Parcel.readException(Parcel.java:1583)

01-25 09:15:47.495 E/AndroidRuntime(15729): at android.app.job.IJobScheduler$Stub$Proxy.schedule(IJobScheduler.java:122)

01-25 09:15:47.495 E/AndroidRuntime(15729): at android.app.JobSchedulerImpl.schedule(JobSchedulerImpl.java:42)

01-25 09:15:47.495 E/AndroidRuntime(15729): at bp.a(SourceFile:85)

01-25 09:15:47.495 E/AndroidRuntime(15729): at bp.a(SourceFile:71)

01-25 09:15:47.495 E/AndroidRuntime(15729): at bc.a(SourceFile:98)

01-25 09:15:47.495 E/AndroidRuntime(15729): at bc.a(SourceFile:69)

01-25 09:15:47.495 E/AndroidRuntime(15729): at bf.g(SourceFile:369)

01-25 09:15:47.495 E/AndroidRuntime(15729): at bf.a(SourceFile:240)

01-25 09:15:47.495 E/AndroidRuntime(15729): at bf.run(SourceFile:166)

01-25 09:15:47.495 E/AndroidRuntime(15729): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)

01-25 09:15:47.495 E/AndroidRuntime(15729): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)

01-25 09:15:47.495 E/AndroidRuntime(15729): at java.lang.Thread.run(Thread.java:818)

Same here

I did it as follows.

@Override
    public boolean onStartJob(JobParameters jobParameters) {
        // TODO Add your task

        // Should be protected to avoid crash in a device where call to jobId() results in NPE. Seems platform error
        try {
            jobFinished(jobParameters, true);
        } catch (NullPointerException ignored) {
        }
}

did this work for you?

I did it as follows.

@Override
    public boolean onStartJob(JobParameters jobParameters) {
        // TODO Add your task

        // Should be protected to avoid crash in a device where call to jobId() results in NPE. Seems platform error
        try {
            jobFinished(jobParameters, true);
        } catch (NullPointerException ignored) {
        }
}

did this work for you?

No. It did not.

I'm also facing the same issue on Android version 5 and 6 only. Did anyone find any sound solution?

same issue

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'int com.android.server.job.controllers.JobStatus.getUid()' on a null object reference at android.os.Parcel.readException(Parcel.java:1552) at android.os.Parcel.readException(Parcel.java:1499) at android.app.job.IJobCallback$Stub$Proxy.jobFinished(IJobCallback.java:167) at android.app.job.JobService$JobHandler.handleMessage(JobService.java:147) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5258) at java.lang.reflect.Method.invoke(Method.java) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

Same issue
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'int com.android.server.job.controllers.JobStatus.getUid()' on a null object reference
at android.os.Parcel.readException(Parcel.java:1605)
at android.os.Parcel.readException(Parcel.java:1552)
at android.app.job.IJobCallback$Stub$Proxy.jobFinished(IJobCallback.java:167)
at android.app.job.JobService$JobHandler.handleMessage(JobService.java:147)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5728)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ruhul015 picture ruhul015  路  4Comments

letos picture letos  路  4Comments

mohamadk picture mohamadk  路  6Comments

pyricau picture pyricau  路  7Comments

vibin picture vibin  路  3Comments