This question has also been asked at Problems with MediaRecorder class setting audio source - setAudioSource() - unsupported parameter, however this author accepted the answer stating that this only occurs on the emulator, while (for me) this is not the case.
The problem occurs on my device, a Galaxy S i9000. The device has a microphone and recording with the microphone works regardless of this error.
The following code reproduces this error (called inside a service):
int sampleRate = AudioTrack.getNativeOutputSampleRate(AudioManager.STREAM_SYSTEM);
int channelMode = AudioFormat.CHANNEL_IN_MONO;
int encodingMode = AudioFormat.ENCODING_PCM_16BIT; //only 16bit encoding is supported
int bufferSize = AudioRecord.getMinBufferSize(sampleRate, channelMode, encodingMode);
recorder = new AudioRecord(MediaRecorder.AudioSource.MIC, sampleRate, channelMode, encodingMode, bufferSize);
Setting the sample rate to a lower value like 8000 does not solve the problem. Setting the channelMode to stereo does not solve the problem.
When executing this code inside my service while the microphone is available for usage, the following errors will be returned:
01-28 14:50:14.860: ERROR/audio_input(2358): unsupported parameter: x-pvmf/media-input-node/cap-config-interface;valtype=key_specific_value
01-28 14:50:14.860: ERROR/audio_input(2358): VerifyAndSetParameter failed
01-28 14:50:15.246: ERROR/PVOMXEncNode(2358): PVMFOMXEncNode-Audio_AMRNB::DoPrepare(): Got Component OMX.SEC.amrenc handle
01-28 14:50:15.258: ERROR/audio_input(2358): unsupported parameter: x-pvmf/media-input-node/cap-config-interface;valtype=key_specific_value
01-28 14:50:15.258: ERROR/audio_input(2358): VerifyAndSetParameter failed
01-28 14:50:15.328: ERROR/audio_input(2358): unsupported parameter: x-pvmf/media-input-node/cap-config-interface;valtype=key_specific_value
01-28 14:50:15.328: ERROR/audio_input(2358): VerifyAndSetParameter failed
01-28 14:50:15.356: ERROR/PVOMXEncNode(2358): PVMFOMXEncNode-Audio_AMRNB::DoPrepare(): Got Component OMX.SEC.amrenc handle
01-28 14:50:15.359: ERROR/audio_input(2358): unsupported parameter: x-pvmf/media-input-node/cap-config-interface;valtype=key_specific_value
01-28 14:50:15.359: ERROR/audio_input(2358): VerifyAndSetParameter failed
01-28 14:50:15.367: ERROR/AudioHardwareALSA(2358): AudioStreamInALSA - input - format = 1, channels = 16, rate = 44100
01-28 14:50:15.367: ERROR/AudioHardwareALSA(2358): AudioStreamInALSA - default - format = 1, channels = 16, rate = 44100
01-28 14:50:15.457: ERROR/AudioFlinger(2358): readInputParameters mInputBytes 8320, mFrameSize 2 mSampleRate 44100 mChannelCount(1)
01-28 14:50:15.457: ERROR/(2358): AFCCreateReSampler: avAFCInfo->bUsed[0] inSampleRate[44100] outSampleRate[44100] nChannel[1] outbitDepth[16]
Does anyone have a solution to this problem?
First, put this in your manifest file:
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Then, you should uninstall your app, and install it again to bring the permission into effect.
I had the same issue as you did. In my case it turned out that the phone SD card is mounted to my PC as USB storage when I connect my Android phone to my machine through USB.
(which makes the App could not get access to the file on the phone SD card)
It worked fine after I turn off the USB storage on my Xperia 10.
Related
I am getting this error why frequently try to tap exoplayer instances.
normally instances releases and nulls itself on everytime.
But after some tries app freezes and crashes. I am trying to find where is the problem related
2019-04-04 11:40:36.002 540-1196/? E/BufferQueueProducer: [com..app.musicplayer/com..app.musicplayer.dashboard.DashboardMusicActivity#0] dequeueBuffer: attempting to exceed the max dequeued buffer count (2)
2019-04-04 11:40:36.110 13761-15052/com..app.musicplayer E/NativeCrypto: AppData::create pipe(2) failed: Too many open files
2019-04-04 11:40:36.121 13761-15052/com..app.musicplayer E/AndroidRuntime: FATAL EXCEPTION: OkHttp Dispatcher
Process: com..app.musicplayer, PID: 13761
java.lang.RuntimeException: javax.net.ssl.SSLException: Unable to create application data
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.newSsl(ConscryptFileDescriptorSocket.java:161)
at com.android.org.conscrypt.ConscryptFileDescriptorSocket.<init>(ConscryptFileDescriptorSocket.java:152)
at com.android.org.conscrypt.OpenSSLSocketFactoryImpl.createSocket(OpenSSLSocketFactoryImpl.java:149)
at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.java:288
I tried to make a tuner for my guitar in android app.
For this I've to used the library AudioRecord.java, but at the compiation an error appears:
07-03 13:48:49.041 2391-2426/? E/AudioRecord: AudioFlinger could not create record track, status: -1
07-03 13:48:49.044 2391-2426/? E/AudioRecord-JNI: Error creating AudioRecord instance: initialization check failed with status -1.
07-03 13:48:49.044 2391-2426/? E/android.media.AudioRecord: Error code -20 when initializing native AudioRecord object.
--------- beginning of crash
07-03 13:48:49.046 2391-2426/? E/AndroidRuntime: FATAL EXCEPTION: Thread-5
Process: com.example.gaetan.tuner, PID: 2391
java.lang.IllegalStateException: startRecording() called on an uninitialized AudioRecord.
at android.media.AudioRecord.startRecording(AudioRecord.java:976)
at com.example.gaetan.tuner.audio.CaptureThread.run(CaptureThread.java:34)
And in AudioRecord.java I can see
import android.os.ServiceManager; cannot be resolved
What can I do to change that?
The issue is likley to do with supported sample rates. The following code will give you a predicate for checking if your desired sample rate is supported.
int sampleRate = 44100;
int bufferSize = AudioRecord.getMinBufferSize(44100, AudioFormat.CHANNEL_CONFIGURATION_DEFAULT, AudioFormat.ENCODING_PCM_16BIT);
if (bufferSize > 0) {
//the sample rate is supported so create your AudioRecord
} else {
// sample size is not supported
}
For a more advanced version featuring that supports multiple sample rates see the answer given here
Hi I'm android beginner
My code had worked a few days ago , suddenly there was problem
How did these errors come from?
Error log
05-18 11:01:52.756 710-722/? E/DatabaseUtils: Writing exception to parcel
java.lang.SecurityException: Permission Denial: get/set setting for user asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL
at com.android.server.am.ActivityManagerService.handleIncomingUser(ActivityManagerService.java:15401)
at android.app.ActivityManager.handleIncomingUser(ActivityManager.java:2512)
at com.android.providers.settings.SettingsProvider.call(SettingsProvider.java:685)
at android.content.ContentProvider$Transport.call(ContentProvider.java:325)
at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:275)
at android.os.Binder.execTransact(Binder.java:404)
at dalvik.system.NativeStart.run(Native Method)
....
05-18 11:01:52.796 748-748/com.buttering.roler E/Login_Activity: Connection to Play Services Failed, error: 4, reason: ConnectionResult{statusCode=SIGN_IN_REQUIRED, resolution=PendingIntent{426e34f0: android.os.BinderProxy#423cbdb8}, message=null}
05-18 11:01:52.796 710-1728/? E/Parcel: Class not found when unmarshalling: com.google.android.gms.common.api.Scope
java.lang.ClassNotFoundException: com.google.android.gms.common.api.Scope
at java.lang.Class.classForName(Native Method)
it clearly say
Connection to Play Services Failed, error: 4, reason: ConnectionResult{statusCode=SIGN_IN_REQUIRED
SIGNIN_REQUIRED
public static final int SIGN_IN_REQUIRED
The client attempted to connect to the service but the user is not
signed in. The client may choose to continue without using the API.
Alternately, if hasResolution() returns true the client may call
startResolutionForResult(Activity, int) to prompt the user to sign in.
After the sign in activity returns with RESULT_OK further attempts
should succeed.
Constant Value: 4
I have a problem with GoogleWrapperSample for OpenSteetMap (I use osmdroid latest jar - 3.0.8). It is compiling fine, but the emulator (Google API 2.2 device) throws a toast with "Activity is not responding" message and nothing else. There are no errors/warnings and as it is a logger in osmdroid classes I can only receive some logging information. LogCat gives something like this:
02-14 13:21:20.246: W/System.err(968): 38 [main] INFO org.osmdroid.views.MapView - Using tile source: org.osmdroid.tileprovider.tilesource.XYTileSource#44eb5260
02-14 13:21:20.316: W/System.err(968): 113 [main] INFO org.osmdroid.tileprovider.modules.MapTileFileStorageProviderBase - sdcard state: mounted
02-14 13:21:20.336: W/System.err(968): 129 [main] INFO org.osmdroid.tileprovider.modules.MapTileFileStorageProviderBase - sdcard state: mounted
02-14 13:21:30.166: I/dalvikvm(968): threadid=3: reacting to signal 3
02-14 13:21:30.207: I/dalvikvm(968): Wrote stack traces to '/data/anr/traces.txt'
Has anyone got this sample working? I have no ideas how to solve this problem.
Maybe, it is somehow connected with getting OSM tiles via network or something like that - we have a proxy connection so https and SSL port are not available (but all in all network on the device is ok).
UPD.
On HTC Desire it works properly but OSM map is not available - there is only a grid. On the other hand, Google map is ok.
LogCat contains this:
02-15 14:47:00.074: W/System.err(2106): 6 [main] INFO org.osmdroid.views.MapView - Using tile source: org.osmdroid.tileprovider.tilesource.XYTileSource#46361618
02-15 14:47:00.084: W/System.err(2106): 23 [main] INFO org.osmdroid.tileprovider.modules.MapTileFileStorageProviderBase - sdcard state: mounted
02-15 14:47:00.094: W/System.err(2106): 26 [main] INFO org.osmdroid.tileprovider.modules.MapTileFileStorageProviderBase - sdcard state: mounted
02-15 14:47:00.184: D/dalvikvm(2106): GC_FOR_MALLOC freed 4349 objects / 315536 bytes in 33ms
02-15 14:47:00.214: D/dalvikvm(2106): GC_EXTERNAL_ALLOC freed 317 objects / 14952 bytes in 28ms
02-15 14:47:00.224: W/System.err(2106): 160 [main] INFO org.osmdroid.tileprovider.MapTileProviderBase - rescale tile cache from 0 to 14
02-15 14:47:00.234: W/System.err(2106): 170 [main] INFO org.osmdroid.tileprovider.MapTileProviderBase - Finished rescale in 10ms
02-15 14:47:00.284: I/MapActivity(2106): Handling network change notification:CONNECTED
02-15 14:47:00.284: E/MapActivity(2106): Couldn't get connection factory client
On emulator there is no progress.
I think that "Couldn't get connection factory client" is the reason of my problem but have no idea about the way to fix this.
There are two situations where an Application Not Responding (ANR) may occur:
No response to an input event (e.g. key press, screen touch) within 5 seconds.
A BroadcastReceiver hasn't finished executing within 10 seconds.
Common causes of an ANR are (stalled) networking operations or expensive calculations.
There are a number of posts on SO on how to solve it (e.g. here or here), but the biggest help is probably the Android API.
I took a quick look at the sample code, I'm not sure but perhaps the setMapView() method that is called in onResume() takes too long. You may be able to test this by commenting that line out. Otherwise, check the traces.txt file on the emulator for clues and/or add logging statements to your code to pinpoint which operation is taking too long.
As for your "Couldn't get connection factory client" error, that question has already been answered here
Oh.. i always have error in prepare (of mediarecorder). Error tell me what prepare failed
i can't record not audio, not video ((
/*
ERROR/audio_input(34): unsupported parameter: x-pvmf/media-input-node/cap-config-interface;valtype=key_specific_value
02-02 12:59:04.813: ERROR/audio_input(34): VerifyAndSetParameter failed
*/
this error what always i have ((( Please can anyone help me.. i realy need help. How to fix this. I tested many examples.. i watch many post's here - but nothing not help me.
Guys - Help please :((((
Regards, Peter.
p.s. sorry for my bad english - hope you understand me.
02-02 12:59:04.623: DEBUG/dalvikvm(9334): GC_FOR_MALLOC freed 4 objects / 307296 bytes in 69ms
02-02 12:59:04.813: ERROR/audio_input(34): unsupported parameter: x-pvmf/media-input-node/cap-config-interface;valtype=key_specific_value
02-02 12:59:04.813: ERROR/audio_input(34): VerifyAndSetParameter failed
02-02 12:59:04.833: ERROR/CameraInput(34): Unsupported parameter(x-pvmf/media-input-node/cap-config-interface;valtype=key_specific_value)
02-02 12:59:04.833: ERROR/CameraInput(34): VerifiyAndSetParameter failed on parameter #0
02-02 12:59:04.873: WARN/AuthorDriver(34): Video encoding bit rate is set to 320000 bps
02-02 12:59:04.933: INFO/MediaRecorderJNI(9334): prepare: surface=0x20fad8 (id=1)
02-02 12:59:04.943: ERROR/PVOMXEncNode(34): PVMFOMXEncNode-Audio_AMRNB::DoPrepare(): Got Component OMX.PV.amrencnb handle
02-02 12:59:04.973: ERROR/CameraInput(34): Camera is not available
02-02 12:59:04.973: ERROR/AuthorDriver(34): Command 13 completed with error -1
02-02 12:59:04.983: ERROR/MediaRecorder(9334): prepare failed: -1
02-02 12:59:06.273: DEBUG/dalvikvm(9334): GC_FOR_MALLOC freed 201 objects / 319048 bytes in 190ms
yeah, sorry forgot about code : code here
function :
private MediaRecorder mediaRecorder;
private File file = null;
static final String PREFIX = "record";
static final String EXTENSION = ".3gpp";
private void startRecording() throws Exception {
mediaRecorder = new MediaRecorder();
mediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
if (file == null) {
File rootDir = Environment.getExternalStorageDirectory();
file = File.createTempFile(PREFIX, EXTENSION, rootDir);
}
mediaRecorder.setOutputFile(file.getAbsolutePath());
mediaRecorder.prepare();
mediaRecorder.start();
Log.i("Start","RECORD STARTED");
}
so.. i never see message("record started") in logcat ((,if add videosurse and videoencode - i have error in IOException - prepare failed. I always have erros and can't find anything what can help me to solved this problem :( . I read more post's about it - and more guys have too problem.. but other guys - have not problem and all be ok.
Now im try only record audio - my emulator is handsup, and in logcat i see only erros what i write before function code. :'(
oh.. android v 2.2 im programming in exclipse galileo
red colors of errors only here :
02-03 13:36:22.783: ERROR/audio_input(34): unsupported parameter: x-pvmf/media-input-node/cap-config-interface;valtype=key_specific_value
02-03 13:36:22.783: ERROR/audio_input(34): VerifyAndSetParameter failed
02-03 13:36:23.004: ERROR/PVOMXEncNode(34): PVMFOMXEncNode-Audio_AMRNB::DoPrepare(): Got Component OMX.PV.amrencnb handle
02-03 13:36:23.073: ERROR/AudioFlinger(34): Error reading audio input
p.s. edited : After updating eclipse and android sdk (all patch's and other function which aviable for downloads. My camera on "all" emulators work perfectly . I can test record/capture photo/ just review on camera. One minus - if bug with preview (green lines or other similar ) than this not showing in emulator. But bugs with rotation ( when on preview all ok and than click on capture or record video we can see what our screen rotated on 90 degree) can be fixed. Hope it's help :)
Just do as per this it works fine
http://developer.android.com/guide/topics/media/index.html