带有歌词的Android音乐播放器在重放时崩溃了

时间:2022-07-29 21:26:11

I created a project called "MusicMod" on Google Code (Based on eliot stocker's Music Mod.) http://code.google.com/p/musicmod/

我在Google Code上创建了一个名为“MusicMod”的项目(基于eliot stocker的Music Mod。)http://code.google.com/p/musicmod/

Screenshot is available on project page

屏幕截图可在项目页面上找到

It can shows lyrics when playing, but crashes when replaying (Sometimes also crashes when k/b pulls out, etc.) Below is My error log:

它可以在播放时显示歌词,但在重放时崩溃(有时在k / b拉出时也会崩溃等)以下是我的错误日志:

W/dalvikvm( 6065): threadid=9: thread exiting with uncaught exception (group=0x400207e8)
E/AndroidRuntime( 6065): FATAL EXCEPTION: Timer-0
E/AndroidRuntime( 6065): java.lang.NullPointerException
E/AndroidRuntime( 6065):    at com.googlecode.musicmod.MediaConnector$1$1.run(MediaConnector.java:65)
E/AndroidRuntime( 6065):    at java.util.Timer$TimerImpl.run(Timer.java:289)
W/ActivityManager(  100):   Force finishing activity com.googlecode.musicmod/.MediaPlaybackActivity
E/ActivityThread( 6065): Activity com.googlecode.musicmod.MediaPlaybackActivity has leaked ServiceConnection com.googlecode.musicmod.MediaConnector$MediaPlayerServiceConnection@43650b18 that was originally bound here
E/ActivityThread( 6065): android.app.ServiceConnectionLeaked: Activity com.googlecode.musicmod.MediaPlaybackActivity has leaked ServiceConnection com.googlecode.musicmod.MediaConnector$MediaPlayerServiceConnection@43650b18 that was originally bound here
E/ActivityThread( 6065):    at android.app.ActivityThread$PackageInfo$ServiceDispatcher.<init>(ActivityThread.java:1121)
E/ActivityThread( 6065):    at android.app.ActivityThread$PackageInfo.getServiceDispatcher(ActivityThread.java:1016)
E/ActivityThread( 6065):    at android.app.ContextImpl.bindService(ContextImpl.java:863)
E/ActivityThread( 6065):    at android.content.ContextWrapper.bindService(ContextWrapper.java:347)
E/ActivityThread( 6065):    at com.googlecode.musicmod.MediaConnector.bindToMusicService(MediaConnector.java:87)
E/ActivityThread( 6065):    at com.googlecode.musicmod.MediaConnector.<init>(MediaConnector.java:48)
E/ActivityThread( 6065):    at com.googlecode.musicmod.MediaPlaybackActivity.onCreate(MediaPlaybackActivity.java:138)
E/ActivityThread( 6065):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
E/ActivityThread( 6065):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
E/ActivityThread( 6065):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
E/ActivityThread( 6065):    at android.app.ActivityThread.access$2300(ActivityThread.java:125)
E/ActivityThread( 6065):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
E/ActivityThread( 6065):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/ActivityThread( 6065):    at android.os.Looper.loop(Looper.java:123)
E/ActivityThread( 6065):    at android.app.ActivityThread.main(ActivityThread.java:4627)
E/ActivityThread( 6065):    at java.lang.reflect.Method.invokeNative(Native Method)
E/ActivityThread( 6065):    at java.lang.reflect.Method.invoke(Method.java:521)
E/ActivityThread( 6065):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
E/ActivityThread( 6065):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
E/ActivityThread( 6065):    at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager(  100): Unbind failed: could not find connection for android.os.BinderProxy@439c5a70
I/Process ( 6065): Sending signal. PID: 6065 SIG: 9

You can also view my source code in my project page. If you can solve this, I can add you as comitter of this project.

您还可以在我的项目页面中查看我的源代码。如果你能解决这个问题,我可以把你当成这个项目的一员。

1 个解决方案

#1


0  

I am not sure regarding that, but it seems that getLyricsContext might return null, and you don't check for it in lines 64-65 of MediaConnector.

我不确定这一点,但似乎getLyricsContext可能返回null,并且您不在MediaConnector的第64-65行中检查它。

Three adiitional things:

三个附加的东西:

  1. when you see at the stack trace a line like this: com.googlecode.musicmod.MediaConnector$1$1.run(MediaConnector.java:65) the $1 refers to an anonymous class. MediaConnector$1$1 means an anonymous class in an anonymous class in MediaConnector.
  2. 当您在堆栈跟踪中看到如下行:com.googlecode.musicmod.MediaConnector $ 1 $ 1.run(MediaConnector.java:65)$ 1指的是匿名类。 MediaConnector $ 1 $ 1表示MediaConnector中匿名类中的匿名类。

  3. You have the exact line where it happens, and you have the exception, it should not be too hard to go to that line and check what might be null at this point.
  4. 你有确切的行,它有例外,它应该不太难去那行,并检查此时可能为null。

  5. When you ask question, please add relevant code next time. People will be more than happy to help if you put more effort and provide more details.
  6. 当您提出问题时,请在下次添加相关代码。如果你付出更多努力并提供更多细节,人们将非常乐意提供帮助。

#1


0  

I am not sure regarding that, but it seems that getLyricsContext might return null, and you don't check for it in lines 64-65 of MediaConnector.

我不确定这一点,但似乎getLyricsContext可能返回null,并且您不在MediaConnector的第64-65行中检查它。

Three adiitional things:

三个附加的东西:

  1. when you see at the stack trace a line like this: com.googlecode.musicmod.MediaConnector$1$1.run(MediaConnector.java:65) the $1 refers to an anonymous class. MediaConnector$1$1 means an anonymous class in an anonymous class in MediaConnector.
  2. 当您在堆栈跟踪中看到如下行:com.googlecode.musicmod.MediaConnector $ 1 $ 1.run(MediaConnector.java:65)$ 1指的是匿名类。 MediaConnector $ 1 $ 1表示MediaConnector中匿名类中的匿名类。

  3. You have the exact line where it happens, and you have the exception, it should not be too hard to go to that line and check what might be null at this point.
  4. 你有确切的行,它有例外,它应该不太难去那行,并检查此时可能为null。

  5. When you ask question, please add relevant code next time. People will be more than happy to help if you put more effort and provide more details.
  6. 当您提出问题时,请在下次添加相关代码。如果你付出更多努力并提供更多细节,人们将非常乐意提供帮助。