我在这里遇到了一些问题,但是他们都没有解决我的问题我已经在清单中添加了MEDIA_BUTTON意图文件管理器
<service android:name=".services.MediaPlayerService">
<intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON" />
</intent-filter>
</service>
但仍然有这次崩溃
Caused by java.lang.IllegalArgumentException: MediaButtonReceiver component may not be null.
at android.support.v4.media.session.MediaSessionCompat$MediaSessionImplBase.<init>(MediaSessionCompat.java:1825)
at android.support.v4.media.session.MediaSessionCompat$MediaSessionImplApi18.<init>(MediaSessionCompat.java:2979)
at android.support.v4.media.session.MediaSessionCompat$MediaSessionImplApi19.<init>(MediaSessionCompat.java:3062)
at android.support.v4.media.session.MediaSessionCompat.<init>(MediaSessionCompat.java:400)
at android.support.v4.media.session.MediaSessionCompat.<init>(MediaSessionCompat.java:346)
at com.abc.abc.services.MediaPlayerService.initMediaSession(MediaPlayerService.java:686)
at com.abc.abc.services.MediaPlayerService.onStartCommand(MediaPlayerService.java:202)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2702)
at android.app.ActivityThread.access$2100(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1293)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(NativeStart.java)
感谢。
答案 0 :(得分:1)
MediaButtonReceiver似乎未初始化......
像: MediaButtonReceiver buttReciver