unity接语音识别报错??
何志敏加油 发布于2015-12 浏览:1994 回复:2
0
收藏

我用unity接了语音识别sdk,运行之后报错,

public class AndroidVoiceActivity extends UnityPlayerActivity implements RecognitionListener{

private static final String TAG = "Touch";

    private static final int EVENT_ERROR = 11;


    private SpeechRecognizer speechRecognizer;

    private long speechEndTime = -1;


    @Override

    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);


        speechRecognizer = SpeechRecognizer.createSpeechRecognizer(this, new ComponentName(this, VoiceRecognitionService.class));

        speechRecognizer.setRecognitionListener(this);

        Log.d(TAG, "----onCreate");

        

    }

    

    public void StartRecord()

    {

    new Handler(Looper.getMainLooper()).post(new Runnable(){

    @Override

    public void run(){

    Log.d(TAG, "----begin1");

           speechRecognizer.cancel();

           Log.d(TAG, "----begin2");

           Intent intent = new Intent();

           Log.d(TAG, "----begin3");

           bindParams(intent);

           Log.d(TAG, "----begin4");

            intent.putExtra("vad", "touch");

           Log.d(TAG, "----begin5");

            

           speechRecognizer.startListening(intent);

           Log.d(TAG, "----begin6");

    }});

   

    }

..........

}

bindParams(intent)设置的参数跟demo一模一样,运行完之后sdk内部报错了?那个大神帮我看看啊????



12-10 09:37:03.768: D/Touch(29408): ----begin6

12-10 09:37:03.840: W/System.err(29408): java.lang.IllegalArgumentException: can't init arg def list

12-10 09:37:03.840: W/System.err(29408): at com.baidu.speech.Args.getDefinition(Args.java:314)

12-10 09:37:03.840: W/System.err(29408): at com.baidu.speech.Args.(Args.java:292)

12-10 09:37:03.840: W/System.err(29408): at com.baidu.speech.Args.(Args.java:287)

12-10 09:37:03.840: W/System.err(29408): at com.baidu.speech.AbsSession.run(AbsSession.java:70)

12-10 09:37:03.840: W/System.err(29408): at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)

12-10 09:37:03.841: W/System.err(29408): at java.util.concurrent.FutureTask.run(FutureTask.java:237)

12-10 09:37:03.841: W/System.err(29408): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)

12-10 09:37:03.841: W/System.err(29408): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)

12-10 09:37:03.841: W/System.err(29408): at java.lang.Thread.run(Thread.java:841)

12-10 09:37:03.841: W/System.err(29408): Caused by: java.lang.NullPointerException

12-10 09:37:03.841: W/System.err(29408): at com.baidu.speech.Args.staticInit(Args.java:47)

12-10 09:37:03.842: W/System.err(29408): at com.baidu.speech.Args.getDefinition(Args.java:311)

12-10 09:37:03.842: W/System.err(29408): ... 8 more

12-10 09:37:03.843: D/Touch(29408): ----识别失败:没有匹配的识别结果:7

12-10 09:37:03.844: D/Touch(29408): ----EVENT_ERROR, #7, No recognition result matched. non expected results: null


收藏
点赞
0
个赞
共2条回复 最后由用户已被禁言回复于2022-04
#3何志敏加油回复于2016-01

这个问题没解决,之后就接了讯飞的了

0
#2159*****606回复于2016-01

我也遇到了类似问题,楼主解决了吗 ? 我的在eclips的android工程里是正常的 ,但是在Unity3d里点击录音就报这个错拉 , 难道android版本语音识别只能集成科大讯飞的拉??

0
TOP
切换版块