MediaPlayer.create() always returns null

前端 未结 2 1536
别那么骄傲
别那么骄傲 2020-12-02 02:30

I have used the mediaplayer before, and I have never had this problem. Whenever I try to use MediaPlayer.create(), the method gives me null, and I can\'t play my sounds. Is

相关标签:
2条回答
  • 2020-12-02 02:48

    In my case, it was the emulator (AVD)

    Make sure that you also test it using a real Android device

    or, create a new AVD profile with better spec and newer Android version

    What seems to always work regardless of which AVD is using 128kbps mp3 audio file

    0 讨论(0)
  • 2020-12-02 03:02

    The create() API returns null if it somehow failed.

    The reason in this case is due to a corrupt mp3 file.

    0 讨论(0)
提交回复
热议问题