ApiLevel 21 batteryLevel 0.63 charging false freeDisk 4.0 freeMemory 182602840 jailbroken false locale enUS locationStatus allowed manufacturer HTC model HTC One networkAccess wifi orientation portrait osBuild LRX22C.H3 release-keys osName android osVersion 5.0.1 screenDensity 3 screenResolution 1920x1080 totalMemory 201326592. 如何在Android Gradle配置中获取当前的buildType 在活动生命周期中处理RxJava / RxAndroid中的订阅的正确方法是什么? 如何改变摄像头预览callback缓冲区的方向? 在Android中启动新活动后调用finish()是个好主意吗?.

I want to use MediaRecorder to record voice, my code is:

Or

On a Samsung all is OK, but on a Dell two methods do not succeed

Here is logcat:

Android.media.mediarecorder._prepare(nativePeter O.
21.7k9 gold badges60 silver badges70 bronze badges
pengwang

Java.io.ioexception Prepare Failed. At Android.media.mediarecorder._prepare(native Method Android 21

pengwang
10.2k30 gold badges105 silver badges165 bronze badges

4 Answers

First at all you code looks fine. Have you added the required permissions to your manifest file?

If yes, then try replacing:

by

Don't forget to check if the path of your video file is correct.

Lazy NinjaLazy Ninja
18.5k9 gold badges67 silver badges90 bronze badges

This is a big problem but has a very small solution

In most cases, the filename that we get from this.file.getAbsolutePath() contains file:/// as a prefix

Hope you find this answer helpful

Sritam SahaSritam Saha

This Exception will be raised . if any of the following things failed:

file not found: Ensure that output file location that yu have specified is existing, otherwise it will throw you filenotfoundexception

Write Permission: You must specify Write permission in your manifest file.

Record permission : specify Record permission in your manifest file.

you can use this..

Still you get error..try display the error. Like this

mRecorder.start();

Vignesh ViperVignesh Viper

I deleted

this.mediaRecorder.setAudioEncodingBitRate(16);

at method 2 and now it's working.

CopsOnRoad
11.4k3 gold badges35 silver badges41 bronze badges
pengwangpengwang
10.2k30 gold badges105 silver badges165 bronze badges

Not the answer you're looking for? Browse other questions tagged androidmedia-player or ask your own question.

Posted by
derekcsm.xyz
5 years ago

It's just crazy, my app will work fine on a Nexus 4 running KitKat but be laggy on a Nexus 5, similarly with an S3, and HTC One?

Java Io Ioexception Prepare Failed Status 0x1

I'm using the media recorder and media player API in the app, is there seriously this much of a difference between phones or am I missing something?

EDIT: Thanks everyone for the help! Much appreciated I think I've solved the problem with the app crashing now simply by checking if the file I'm looking to play exists using..

if (arg1.getAction() MotionEvent.ACTION_DOWN) {

Mediarecorder Prepare Failed

11 comments
Coments are closed
Scroll to top