模拟器中的语音到文本:找不到处理 Intent 的活动
我想问如何在模拟器上使用语音转文本代码。我的代码可以在真实设备上运行,但不能在模拟器上运行。错误说:
No Activity found to handle Intent { act=android.speech.action.RECOGNIZE_SPEECH (has extras) }
我能做什么?
I want to ask how I can use speech to text code on my emulator. My codes work on real device but not work on emulator. The error said :
No Activity found to handle Intent { act=android.speech.action.RECOGNIZE_SPEECH (has extras) }
What can I do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您需要在模拟器上安装一个包含处理
RECOGNIZE_SPEECH
意图的 Activity 的应用程序。您也许可以在网络上找到 Google 的VoiceSearch.apk
。You need to install onto your emulator an app that contains an Activity that handles the
RECOGNIZE_SPEECH
-intent. You might be able to find Google'sVoiceSearch.apk
on the web.有些事情无法使用模拟器进行测试。语音转文本就是其中之一。
我不确定这一点,但你不能在模拟器上使用这个 android 功能。
无论如何,您应该使用 try/catch 来处理此异常,并向用户提供一些反馈。
您可以检查运行您的应用的当前设备中是否有该
Activity
,执行以下操作:如果有帮助,请告诉我。
There are certain things you can't test using an emulator. Speech to text is on of them.
I'm not sure about this, but you can't use this android feature with the emulator.
No matter what, you should handle this exception with a try/ catch an give some feedback to the user.
You can check if there is that
Activity
in current device running your app doing something like:Let me know if it helps.
您需要在没有语音识别活动的目标设备上安装
com.google.android.voicesearch
应用程序,例如:如果您尝试安装 Google 的搜索应用程序 - 它不会有帮助,因为它不包含VR 引擎内部,因此它将尝试执行相同的操作 - 安装
com.google.android.voicesearch
应用程序,但由于包名称 (pname:com.google) 中的错误,它可能会失败.android.voicesearch
而不仅仅是纯包名)。但是,由于“在您所在的国家/地区不可用”,com.google.android.voicesearch
安装可能无法进行。You need to install
com.google.android.voicesearch
application on target device which has no voice recognition activity like:if you try to install Google's Search app - it won't help since it doesn't contain the VR engine inside and thus it will try to do the same - install
com.google.android.voicesearch
app but it could fail due to a bug in package name (pname:com.google.android.voicesearch
instead of just pure package name). Howevercom.google.android.voicesearch
installation might be impossible due to "Not available in your country".您可能需要虚拟 SD 卡。您可以参考 这里
You might need a virtual SD Card. You can refer here