Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException when DownloadService is re-started by Android and action is NULL #4488

Closed
fpittersacc opened this issue Jul 9, 2018 · 1 comment
Assignees
Labels

Comments

@fpittersacc
Copy link

Issue description

When DownloadService is re-launched by Android OS the intent passed on onStartCommand is NULL. Then a NPE is raised on DownloadService::230 -> switch (intentAction) {

As a temporary workaround you can protect the intent passed to DownloadService extending onStartCommand on your version of DemoDownloadService.

Reproduction steps

Using ExoPlayer Demo:

  1. Start a download.
  2. Stop the application using Android Studio "Terminates selected application" button on Logcat tab.

Service will be started again by OS.

Version of ExoPlayer being used

2.8.2

Device(s) and version(s) of Android being used

Nexus 5X - 8.1.0,
Samsung S6 - 6.0.1
(Should be reproducible on any Android device/version)

A full bug report captured from the device

07-09 12:46:55.421 30358-30358/com.google.android.exoplayer2.demo E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.google.android.exoplayer2.demo, PID: 30358
    java.lang.RuntimeException: Unable to start service com.google.android.exoplayer2.demo.DemoDownloadService@7d9833f with null: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.hashCode()' on a null object reference
        at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4080)
        at android.app.ActivityThread.access$2400(ActivityThread.java:222)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1898)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:158)
        at android.app.ActivityThread.main(ActivityThread.java:7229)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
     Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.hashCode()' on a null object reference
        at com.google.android.exoplayer2.offline.DownloadService.onStartCommand(DownloadService.java:229)

bugreport-bullhead-OPM2.171019.029-2018-07-09-13-12-43.zip

@ojw28 ojw28 added the bug label Jul 9, 2018
ojw28 pushed a commit that referenced this issue Jul 10, 2018
Also fixed showing "remove notification" when download is completed.

Issue:#4469
Issue:#4488

-------------
Created by MOE: https:/google/moe
MOE_MIGRATED_REVID=203927268
@ojw28
Copy link
Contributor

ojw28 commented Jul 17, 2018

Fixed in dev-v2.

@ojw28 ojw28 closed this as completed Jul 17, 2018
ojw28 pushed a commit that referenced this issue Jul 23, 2018
Also fixed showing "remove notification" when download is completed.

Issue:#4469
Issue:#4488

-------------
Created by MOE: https:/google/moe
MOE_MIGRATED_REVID=203927268
@google google locked and limited conversation to collaborators Nov 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants