MediaPlayer: error (1, -2147483648) 

I get this error all the time. Compile in API 24 and Java 1.8

 if (sound.isChecked()) { mediaPlayer = new MediaPlayer(); mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); try{ mediaPlayer.setDataSource(this, Uri.parse("file:///android_asset/audio.mp3")); mediaPlayer.prepare(); } catch (IOException e) { e.printStackTrace(); } mediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { @Override public void onPrepared(MediaPlayer mp) { mediaPlayer.start(); } }); }else { mediaPlayer.stop(); } break; 

The code as you can see is normal. Already tried everything

Even after the launch. Although nothing works. I press the play button and get

 Error (-19,0) 

If you press again, it will stop Error (-38,0)

  • Could you paraphrase what does not work anymore? Did it work before? After what actions did it stop working? - Silento pm
  • @Asgard, I wrote above. After the update. Compile on API 24 and Java 1.8 - Andro
  • And when did the versions work? - xkor 5:09
  • @xkor, Well, it worked 3 months ago. When I last launched. If you do not believe then create your own. Compile in API 24. Not 19. And 24. And try. - Andro
  • Are you sure that nothing useful is written to the log? - xkor

2 answers 2

The problem was solved by installing codecs on the phone. All ATP. I leave the topic suddenly need someone. So as not to suffer

    API 24 is in the preview stage, and questions that something does not work in it should be rejected by default , since it is not yet ready for use. Do not use API 24 if you expect your application to work at all.

    • Generally speaking, as far as I understand, API 24 will be released for a month - xkor
    • @xkor, in the first paragraph of your link it says that the 4th Developer Preview has been released . This is exactly what I wrote in the answer. - Vladyslav Matviienko
    • 4th Developer Preview of Android N and including the Android N final SDK , that is, as far as I understand - API 24 has been released, androyd itself with the implementation of this api is currently available in the form of 4th dev previews. In short, API 24 as a target can already be used in production. But I agree that even though it is already possible, but is it necessary ... - xkor