初始化百度语音唤醒SDK时出现Error : java.io.IOException: Unable to create temporary file
WillieXie 发布于2017-08 浏览:2473 回复:1
0
收藏

我使用的服务是:语音唤醒

调用的接口是:com.baidu.speech.EventManager.send

参数设置情况:mWakeUpEventManager.send("wp.start", new JSONObject(params).toString(), null, 0, 0);

开发平台和机型:Android 7.0, Galaxy Note5 

SDK版本号:VoiceRecognition-2.2.1027

代码或日志截图(上传截图能帮助您更快解决问题):

    /**

     * 开始语音唤醒

     */

    @Override

    public void startWakeUp() {

        HashMap params = new HashMap();

        params.put("kws-file", "assets:///WakeUp.bin"); // 设置唤醒资源, 唤醒资源请到 http://yuyin.baidu.com/wake#m4 来评估和导出

        mWakeUpEventManager.send("wp.start", new JSONObject(params).toString(), null, 0, 0);

    }


08-31 15:04:49.700 21393 21393 W System.err: java.io.IOException: Unable to create temporary file

08-31 15:04:49.700 21393 21393 W System.err: at java.io.File.generateTempFile(File.java:1773)

08-31 15:04:49.700 21393 21393 W System.err: at java.io.File.createTempFile(File.java:1860)

08-31 15:04:49.700 21393 21393 W System.err: at com.baidu.speech.asr.WakeUpControl.loadSourceFromUri(WakeUpControl.java:294)

08-31 15:04:49.700 21393 21393 W System.err: at com.baidu.speech.asr.WakeUpControl.initWp(WakeUpControl.java:145)

08-31 15:04:49.700 21393 21393 W System.err: at com.baidu.speech.asr.WakeUpControl.postEvent(WakeUpControl.java:104)

08-31 15:04:49.700 21393 21393 W System.err: at com.baidu.speech.asr.EventManagerWp.send(EventManagerWp.java:50)

08-31 15:04:49.700 21393 21393 W System.err: at com.invision.unitysdk.thirdpart.asr.BaiduASR.startWakeUp(BaiduASR.java:321)

08-31 15:04:49.700 21393 21393 W System.err: at com.invision.unitysdk.thirdpart.ThirdPartManager.onResume(ThirdPartManager.java:91)

08-31 15:04:49.700 21393 21393 W System.err: at com.invision.unitysdk.controller.MainController.onResume(MainController.java:56)

08-31 15:04:49.700 21393 21393 W System.err: at com.invision.unitysdk.InVisionUnityActivity.onResume(InVisionUnityActivity.java:92)

08-31 15:04:49.700 21393 21393 W System.err: at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1277)

08-31 15:04:49.700 21393 21393 W System.err: at android.app.Activity.performResume(Activity.java:7088)

08-31 15:04:49.700 21393 21393 W System.err: at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3768)

08-31 15:04:49.700 21393 21393 W System.err: at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3832)

08-31 15:04:49.700 21393 21393 W System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2994)

08-31 15:04:49.700 21393 21393 W System.err: at android.app.ActivityThread.-wrap14(ActivityThread.java)

08-31 15:04:49.700 21393 21393 W System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1631)

08-31 15:04:49.700 21393 21393 W System.err: at android.os.Handler.dispatchMessage(Handler.java:102)

08-31 15:04:49.700 21393 21393 W System.err: at android.os.Looper.loop(Looper.java:154)

08-31 15:04:49.700 21393 21393 W System.err: at android.app.ActivityThread.main(ActivityThread.java:6682)

08-31 15:04:49.700 21393 21393 W System.err: at java.lang.reflect.Method.invoke(Native Method)

08-31 15:04:49.700 21393 21393 W System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)

08-31 15:04:49.700 21393 21393 W System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)

复现步骤、现象及其他描述:

必现。startWakeUp()方法是在onResume()之后调用。

导致的问题是无法使用语音唤醒功能。

收藏
点赞
0
个赞
共1条回复 最后由用户已被禁言回复于2022-04
#2fujiayi1984回复于2017-09

WillieXie:

我使用的服务是:语音唤醒

调用的接口是:com.baidu.speech.EventManager.send

参数设置情况:mWakeUpEventManager.send("wp.start", new JSONObject(params).toString(), null, 0, 0);

开发平台和机型:Android 7.0, Galaxy Note5 

SDK版本号:VoiceRecognition-2.2.1027

代码或日志截图(上传截图能帮助您更快解决问题):

    /**

     * 开始语音唤醒

     */

    @Override

    public void startWakeUp() {

        HashMap params = new HashMap();

        params.put("kws-file", "assets:///WakeUp.bin"); // 设置唤醒资源, 唤醒资源请到 http://yuyin.baidu.com/wake#m4 来评估和导出

        mWakeUpEventManager.send("wp.start", new JSONObject(params).toString(), null, 0, 0);

    }


08-31 15:04:49.700 21393 21393 W System.err: java.io.IOException: Unable to create temporary file

08-31 15:04:49.700 21393 21393 W System.err:  at java.io.File.generateTempFile(File.java:1773)

08-31 15:04:49.700 21393 21393 W System.err:  at java.io.File.createTempFile(File.java:1860)

08-31 15:04:49.700 21393 21393 W System.err:  at com.baidu.speech.asr.WakeUpControl.loadSourceFromUri(WakeUpControl.java:294)

08-31 15:04:49.700 21393 21393 W System.err:  at com.baidu.speech.asr.WakeUpControl.initWp(WakeUpControl.java:145)

08-31 15:04:49.700 21393 21393 W System.err:  at com.baidu.speech.asr.WakeUpControl.postEvent(WakeUpControl.java:104)

08-31 15:04:49.700 21393 21393 W System.err:  at com.baidu.speech.asr.EventManagerWp.send(EventManagerWp.java:50)

08-31 15:04:49.700 21393 21393 W System.err:  at com.invision.unitysdk.thirdpart.asr.BaiduASR.startWakeUp(BaiduASR.java:321)

08-31 15:04:49.700 21393 21393 W System.err:  at com.invision.unitysdk.thirdpart.ThirdPartManager.onResume(ThirdPartManager.java:91)

08-31 15:04:49.700 21393 21393 W System.err:  at com.invision.unitysdk.controller.MainController.onResume(MainController.java:56)

08-31 15:04:49.700 21393 21393 W System.err:  at com.invision.unitysdk.InVisionUnityActivity.onResume(InVisionUnityActivity.java:92)

08-31 15:04:49.700 21393 21393 W System.err:  at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1277)

08-31 15:04:49.700 21393 21393 W System.err:  at android.app.Activity.performResume(Activity.java:7088)

08-31 15:04:49.700 21393 21393 W System.err:  at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3768)

08-31 15:04:49.700 21393 21393 W System.err:  at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3832)

08-31 15:04:49.700 21393 21393 W System.err:  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2994)

08-31 15:04:49.700 21393 21393 W System.err:  at android.app.ActivityThread.-wrap14(ActivityThread.java)

08-31 15:04:49.700 21393 21393 W System.err:  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1631)

08-31 15:04:49.700 21393 21393 W System.err:  at android.os.Handler.dispatchMessage(Handler.java:102)

08-31 15:04:49.700 21393 21393 W System.err:  at android.os.Looper.loop(Looper.java:154)

08-31 15:04:49.700 21393 21393 W System.err:  at android.app.ActivityThread.main(ActivityThread.java:6682)

08-31 15:04:49.700 21393 21393 W System.err:  at java.lang.reflect.Method.invoke(Native Method)

08-31 15:04:49.700 21393 21393 W System.err:  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)

08-31 15:04:49.700 21393 21393 W System.err:  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)

复现步骤、现象及其他描述:

必现。startWakeUp()方法是在onResume()之后调用。

导致的问题是无法使用语音唤醒功能。

回复WillieXie:请先测试下demo是否有此问题。

0
TOP
切换版块