[Solved] Click the play button to display: e/mediaplayer: error (1, – 2147483648)

Problem Description:

Click the play button to display:
e/mediaplayer: error (1, – 2147483648)
e/mediaplayer: error (1, – 2147483648)


Cause analysis:

Although the package service is created and the package name is displayed as follows:


an error will occur if the code is written as follows:

mediaPlayer.setDataSource(context,Uri.parse("android.resource://com.example.homework07.service/" + musics[musicIndex]));

Solution:

Delete the. Service in the code as follows

mediaPlayer.setDataSource(context,Uri.parse("android.resource://com.example.homework07/" + musics[musicIndex]));

Read More: