question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

App crashes on low android level **Java.IO.IOException:** 'Prepare failed.: status=0x1'

See original GitHub issue

Hello, I managed to play the sound by watching the video on youtube (android 10.11), but, On an old device (android 6.0.1) etc. It directly causes my application to crash. Its output is;

[MediaPlayer] error (1, -2147483648)
**Java.IO.IOException:** 'Prepare failed.: status=0x1'
[mono-rt] [ERROR] FATAL UNHANDLED EXCEPTION: Java.IO.IOException: Prepare failed.: status=0x1
[mono-rt] at Java.Interop.JniEnvironment.InstanceMethods.CallVoidMethod(JniObjectReference instance, JniMethodInfo method, JniArgumentValue* args) in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/ java.Interop/obj/Release/net7.0/JniEnvironment.g.cs:line 11884
[mono-rt] at Java.Interop.JniPeerMembers.JniInstanceMethods.InvokeVirtualVoidMethod(String encodedMember, IJavaPeerable self, JniArgumentValue* parameters) in /Users/runner/work/1/s/xamarin-android/external/Java/Interop Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods_Invoke.cs:line 66
[mono-rt] at Android.Media.MediaPlayer.Prepare() in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net7.0/android-33/mcw /Android.Media.MediaPlayer.cs:line 3748
[mono-rt] at Plugin.Maui.Audio.AudioPlayer..ctor(Stream audioStream)
[mono-rt] at Plugin.Maui.Audio.AudioManager.CreatePlayer(Stream audioStream)
var player = audioManager.CreatePlayer(await FileSystem.OpenAppPackageFileAsync("sound.wav"));
            player.Loop = true;
            player.Play();
}

What is the solution? I want to use this library.

Issue Analytics

  • State:closed
  • Created 7 months ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jfversluiscommented, Feb 16, 2023

Could you maybe add a reproduction project for this so I can have a look?

The error doesn’t have a lot of info, but this line: **Java.IO.IOException:** 'Prepare failed.: status=0x1' makes me think that it either can’t find the file that you specify or you didn’t request the necessary permissions.

Also, just to set expectations: I understand this might be urgent to you, I appreciate that, however I may have different priorities than you. I cannot make any promises about if and when this will be fixed. This project is a community effort, which we are not being paid for.

0reactions
ertandkcommented, Feb 16, 2023

The phone does not support the wav format. Audio playback with m4a format is successful. Thank you so much for your support and suggestions! I was about to go crazy 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android MediaPlayer java.io.IOException: Prepare failed.
I am using Android's MediaPlayer to set up a URL stream in my application. I have tried several different posts to deal with...
Read more >
No playback (Prepare failed.: status=0x1) · Issue #75
Hello, I'm using this component and it's working normally on several devices, but not on two devices with Android 10.
Read more >
Problem loading songs Prepare failed.: status =0x1
My emulater is Android 8.1(API Level 27 - Oreo) I'm using Visual Studio. Your help is greatly appreciated. Full exception: Java.IO.IOException: ...
Read more >
Crashes | App quality
An Android app crashes whenever there's an unexpected exit caused by an unhandled exception or signal. An app that is written using Java...
Read more >
Android MediaPlayer throwing "Prepare failed.: status=0x1" on ...
Android : Android MediaPlayer throwing " Prepare failed.: status=0x1 " on 2.1, works on 2.2 [ Beautify Your Computer ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found