Skip to content

NullPointerException when running setMediaItem #41

@alexelisenko

Description

@alexelisenko

When the background service is running and playing an item, if I call AudioService.stop(), then play() on a new item, I call the AudioServiceBackground.setMediaItem() method and get the following error:

03:58:49.305 90 info flutter.tools E/MethodChannel#ryanheise.com/audioServiceBackground(31568): Failed to handle method call
03:58:49.305 91 info flutter.tools E/MethodChannel#ryanheise.com/audioServiceBackground(31568): java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String[] java.lang.String.split(java.lang.String)' on a null object reference
03:58:49.305 92 info flutter.tools E/MethodChannel#ryanheise.com/audioServiceBackground(31568): 	at com.ryanheise.audioservice.AudioService.getResourceId(AudioService.java:136)
03:58:49.305 93 info flutter.tools E/MethodChannel#ryanheise.com/audioServiceBackground(31568): 	at com.ryanheise.audioservice.AudioService.buildNotification(AudioService.java:188)
03:58:49.305 94 info flutter.tools E/MethodChannel#ryanheise.com/audioServiceBackground(31568): 	at com.ryanheise.audioservice.AudioService.updateNotification(AudioService.java:285)
03:58:49.305 95 info flutter.tools E/MethodChannel#ryanheise.com/audioServiceBackground(31568): 	at com.ryanheise.audioservice.AudioService.setMetadata(AudioService.java:398)
03:58:49.305 96 info flutter.tools E/MethodChannel#ryanheise.com/audioServiceBackground(31568): 	at com.ryanheise.audioservice.AudioServicePlugin$BackgroundHandler.onMethodCall(AudioServicePlugin.java:543)
03:58:49.305 97 info flutter.tools E/MethodChannel#ryanheise.com/audioServiceBackground(31568): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:201)
03:58:49.305 98 info flutter.tools E/MethodChannel#ryanheise.com/audioServiceBackground(31568): 	at io.flutter.view.FlutterNativeView$PlatformMessageHandlerImpl.handleMessageFromDart(FlutterNativeView.java:188)
03:58:49.305 99 info flutter.tools E/MethodChannel#ryanheise.com/audioServiceBackground(31568): 	at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:202)
03:58:49.305 100 info flutter.tools E/MethodChannel#ryanheise.com/audioServiceBackground(31568): 	at android.os.MessageQueue.nativePollOnce(Native Method)
03:58:49.305 101 info flutter.tools E/MethodChannel#ryanheise.com/audioServiceBackground(31568): 	at android.os.MessageQueue.next(MessageQueue.java:326)
03:58:49.305 102 info flutter.tools E/MethodChannel#ryanheise.com/audioServiceBackground(31568): 	at android.os.Looper.loop(Looper.java:160)
03:58:49.305 103 info flutter.tools E/MethodChannel#ryanheise.com/audioServiceBackground(31568): 	at android.app.ActivityThread.main(ActivityThread.java:6680)
03:58:49.305 104 info flutter.tools E/MethodChannel#ryanheise.com/audioServiceBackground(31568): 	at java.lang.reflect.Method.invoke(Native Method)
03:58:49.305 105 info flutter.tools E/MethodChannel#ryanheise.com/audioServiceBackground(31568): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
03:58:49.305 106 info flutter.tools E/MethodChannel#ryanheise.com/audioServiceBackground(31568): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

Any help or ideas on what could be wrong would be greatly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions