帖子

Android 离线命令词,自动闪退而且无报错

[复制链接]

该用户从未签到

1504 178****9156 发表于 6 天前 1#
我在我们项目中集成离线语音听写和离线命令词功能,离线语音听写测试了一下可以正常使用,但是换成离线命令词会出现闪退情况,并且无报错。
具体情况如下:
调用开始语音识别方法后在识别监听器中收到 onVolumeChanged()返回回来的数据。当一句话结束后零点几秒之后,程序闪退,而且logcat无报错,并且没有收到 onEndOfSpeech()返回回来的结束说话的消息。
抓到的日志如下:
05-13 15:33:22.599 11787 11819 W ContextImpl: Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1067 com.android.server.notification.DisplayToast.sendIntentForToastDumpLog:156 com.android.server.notification.DisplayToast.outFile:106 com.android.server.notification.DisplayToast.out:62 com.android.server.notification.NotificationManagerService$12.enqueueToastForDisplay:2327
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: BLOCKED 10206
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: UNBLOCKED 10206
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: BLOCKED 10399
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: UNBLOCKED 10135
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: BLOCKED 10135
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: BLOCKED 10063
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: UNBLOCKED 10063
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: BLOCKED 10199
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: UNBLOCKED 10009
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: BLOCKED 10009
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: BLOCKED 10210
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: UNBLOCKED 10210
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: UNBLOCKED 10199
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: UNBLOCKED 10399
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: BLOCKED 10399
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: BLOCKED 10199
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: UNBLOCKED 10199
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: BLOCKED 10199
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: UNBLOCKED 10009
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: UNBLOCKED 10399
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: BLOCKED 10009
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: UNBLOCKED 10296
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: BLOCKED 10776
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: UNBLOCKED 10776
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: BLOCKED 10296
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: UNBLOCKED 10207
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: BLOCKED 10046
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: BLOCKED 15010046
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: UNBLOCKED 10046
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: BLOCKED 10046
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: UNBLOCKED 10046
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: UNBLOCKED 10009
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: BLOCKED 10009
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: UNBLOCKED 10199
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: UNBLOCKED 10009
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: UNBLOCKED 10135
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: BLOCKED 10009
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: BLOCKED 10135
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: BLOCKED 10190
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: BLOCKED 10181
05-13 15:33:22.600 11787 12432 D ConnectivityService: mDiagnosticHisotry, str: BLOCKED 10777
05-13 15:33:22.601 22361 22361 D HomeActivity: 返回音频数据:1280
05-13 15:33:22.611 22361 22366 I teaching.Maxhu: Compiler allocated 4MB to compile void android.view.ViewRootImpl.performTraversals()
05-13 15:33:22.625 11787 22539 W ActivityManager: crash : com.cas.multimediateaching.Maxhub,0
05-13 15:33:22.627 11787 22539 W ActivityManager:   Force finishing activity com.cas.multimediateaching.Maxhub/com.cas.multimediateaching.ui.activity.HomeActivity
05-13 15:33:22.628 11787 11787 D Telecom:SamsungPrebindingServiceImpl: onTopActivityChanged ComponentInfo{com.sec.android.app.launcher/com.sec.android.app.launcher.activities.LauncherActivity}


环境:Android9.0

有没有同仁遇到相似问题,指点一下。


讯飞2017hj 发表于 5 天前
2#
直接测试一下sdk中的demo中的离线命令词识别是否正常呢?

楼内回复

demo中可以正常使用,我这边集成进去听写是好用的,离线命令词就是改几个参数,而且可以正常启动,就是结束的时候会崩溃  详情 发表于 5 天前
使用道具 举报 回复
178****9156 发表于 5 天前
3#
讯飞2017hj 发表于 2019-5-14 09:23
直接测试一下sdk中的demo中的离线命令词识别是否正常呢?

demo中可以正常使用,我这边集成进去听写是好用的,离线命令词就是改几个参数,而且可以正常启动,就是结束的时候会崩溃
使用道具 举报 回复
178****9156 发表于 5 天前
4#
找到原因了,讯飞文档有点不全面,demo里面的so库只有armeabi,如果需要其他类型cpu的so库,需要在你的application模块下的build.gradle文件下加上如下代
码:
ndk {
    //选择要添加的对应cpu类型的.so库。
    abiFilters 'x86', 'armeabi', 'armeabi-v7a', 'armeabi-v8a','x86_64'
}
文档中缺少这一块说明。

但是这就引发一个疑问,在加这个之前我的离线语音听写功能是可以用的,离线命令词功能不可以用。这就说明是不是有某些包的功能缺失。


使用道具 举报 回复
讯飞2017hj 发表于 4 天前
5#
这个不排除,但是需要根据自己的cpu选择对应的库。
使用道具 举报 回复