为什么无法在 Android 模拟器上使用语音记录器? [英] Why is it impossible to use the Speech Recorder on the Android emulator?

查看:43
本文介绍了为什么无法在 Android 模拟器上使用语音记录器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行 Android 2.2 模拟器附带的语音记录器.问题是我点击录制"按钮的那一刻:

I am trying to run the Speech Recorder that comes with the Android 2.2 emulator. The problem is that the moment I click the "Record" button:

它中止并显示错误消息应用程序语音记录器(进程 com.android.speechrecorder)已意外停止.请重试."

It aborts with an error message "The application Speech Recorder (process com.android.speechrecorder) has stopped unexpectedly. Please try again."

问题是再试也无济于事.

The problem is that trying again doesn't help.

现在,我搜索了 StackOverflow 并梳理了整个互联网,发现很多关于同样问题的报告,但没有任何可行的解决方案.

Now, I searched StackOverflow and I combed the entire Internet and I found many reports of the same problem, without any working solution.

我的结论是,出于某种奇怪的原因,Android 模拟器能够使用 Windows 音频设备进行输出,但不能用于输入.

My conclusion is that, for some strange reason, the Android emulator is capable of using the Windows audio device for output, but not for input.

这是为什么?

我知道其他虚拟化软件(例如 VMWare)在使用主机音频设备的输出和输入部分时没有问题.

I know that other virtualization software (e.g. VMWare) have no problem using both output and input sections of the host's audio device.

此外,如果语音记录器从来没有为任何人的模拟器工作过,为什么要把它放在那里?

Also, if Speech Recorder never worked for the emulator for anyone, why put it there?

当然这对某人有用.有没有办法让 Speech Recorder 也对我有用?

Surely this has worked for someone. Is there a way to make Speech Recorder work for me, too?

我使用的是 32 位 Windows XP,我的 AVD 是用 SD 卡定义的(在启动时安装).

I am using Windows XP 32-bit and my AVD is defined with an SD card (mounted upon start).

更新:我按照@Klaus 的建议尝试查看是否抛出任何异常.我通过在命令行中简单地输入 ddms.bat 来启动 DDMS 的独立版本(在底部带有 logcat 显示).果然,我在点击录制"按钮时收到以下异常:

Update: I followed the suggestion by @Klaus to try and see whether any exceptions are thrown. I did so by simply typing ddms.bat at the command line to launch a stand-alone version of DDMS (with a logcat display at the bottom). Sure enough, I receive the following exception upon clicking the "Record" button:

03-29 14:16:58.195: ERROR/AudioRecord(303): Could not get audio input for record source 1
03-29 14:16:58.195: ERROR/srec_jni(303): initCheck error -22 
03-29 14:16:58.205: DEBUG/SpeechRecorderActivity(303): run audio capture thread
03-29 14:16:58.205: WARN/dalvikvm(303): threadid=8: thread exiting with uncaught exception (group=0x4001d800)
03-29 14:16:58.215: ERROR/AndroidRuntime(303): FATAL EXCEPTION: Thread-9
03-29 14:16:58.215: ERROR/AndroidRuntime(303): java.lang.NullPointerException
03-29 14:16:58.215: ERROR/AndroidRuntime(303):     at com.android.speechrecorder.SpeechRecorderActivity$4.run(SpeechRecorderActivity.java:192)
03-29 14:16:58.285: WARN/ActivityManager(59):   Force finishing activity com.android.speechrecorder/.SpeechRecorderActivity
03-29 14:16:58.904: DEBUG/dalvikvm(59): GC_FOR_MALLOC freed 13324 objects / 656184 bytes in 197ms
03-29 14:16:59.915: INFO/ARMAssembler(59): generated scanline__00000077:03515104_00000000_00000000 [ 33 ipp] (47 ins) at [0x20db68:0x20dc24] in 1247352 ns
03-29 14:17:05.251: DEBUG/SpeechRecorderActivity(303): stopRecording

我如何从这里开始?我没有编写 Speech Recorder 应用程序,所以我不知道是什么原因导致 SpeechRecorderActivity.java 第 192 行出现 NullPointerException.我相信这与之前的 logcat 消息有关:

How do I proceed from here? I didn't write the Speech Recorder app, so I don't know what causes the NullPointerException at SpeechRecorderActivity.java line 192. I believe this has something to do with an earlier logcat message:

无法获得录音输入来源 1

Could not get audio input for record source 1

但问题又是为什么?

为什么不能获取记录源 1 的音频输入"?

Why wasn't it able to "get audio input for record source 1"?

推荐答案

您遇到此问题的原因是模拟器没有用于挂钩的音频输入.最好的办法是插入真实设备并在那里进行测试.

The reason you're having this issue is that the emulator doesn't have an audioInput to hook. Your best bet is to plug a real device in and do testing there.

这篇关于为什么无法在 Android 模拟器上使用语音记录器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆