简体   繁体   中英

Caused by java.lang.IllegalArgumentException: MediaButtonReceiver component may not be null

I came across some questions here but None of them solved my issue I have already added MEDIA_BUTTON intent filer in manifest

<service android:name=".services.MediaPlayerService">
    <intent-filter>
        <action android:name="android.intent.action.MEDIA_BUTTON" />
    </intent-filter>
</service>

But still have this crash

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)

Thanks.

MediaButtonReceiver seems not initialized...

like: MediaButtonReceiver buttReciver

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM