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

java.lang.NullPointerException: Attempt to invoke virtual method 'void com.lzx.musiclibrary.control.PlayControl.stopMusic()' #44

Closed
JeremyHwc opened this issue Jul 18, 2018 · 2 comments

Comments

@JeremyHwc
Copy link

java.lang.RuntimeException:Unable to stop service com.lzx.musiclibrary.MusicService@e55f5c1: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.lzx.musiclibrary.control.PlayControl.stopMusic()' on a null object reference
android.app.ActivityThread.handleStopService(ActivityThread.java:3436)

Caused by:
java.lang.NullPointerException:Attempt to invoke virtual method 'void com.lzx.musiclibrary.control.PlayControl.stopMusic()' on a null object reference
com.lzx.musiclibrary.MusicService.onDestroy(MusicService.java)
android.app.ActivityThread.handleStopService(ActivityThread.java:3419)
android.app.ActivityThread.-wrap27(ActivityThread.java)
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1630)
android.os.Handler.dispatchMessage(Handler.java:102)
android.os.Looper.loop(Looper.java:154)
android.app.ActivityThread.main(ActivityThread.java:6211)
java.lang.reflect.Method.invoke(Native Method)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:793)

系统版本
Android 7.1.2,level 25

ROM
vivo/FUNTOUCH

CPU架构
arm64-v8a

建议在MusicService里面这段代码里面做下非空判断

@OverRide
public void onDestroy() {
super.onDestroy();
mBinder.stopMusic();
mBinder.releaseMediaSession();
}

@EspoirX
Copy link
Owner

EspoirX commented Jul 18, 2018

@EspoirX
Copy link
Owner

EspoirX commented Jul 18, 2018

已经添加判空处理

@EspoirX EspoirX closed this as completed Jul 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants