Xamarin.Android在执行本机代码时获得了SIGSEGV

时间:2017-07-26 13:41:17

标签: c# android xamarin cmusphinx pocketsphinx

我正在使用Pocketsphinx创建我的应用程序。但最近有这个恼人的“错误”:

我在互联网上找不到任何有关这一特定内容的信息。提前致谢

编辑,我需要将我的代码放入:

     public void OnPartialResult(Hypothesis hypothesis)
    {

        if (hypothesis == null)
        {
            return;
        }
        string text = hypothesis.Hypstr;
        Label.Text = text;
    }

    public void OnResult(Hypothesis hypothesis)
    {

        Label.Text = "";
        if (hypothesis != null)
        {
            string text = hypothesis.Hypstr;

            Toast.MakeText(this, text, ToastLength.Short).Show();
        }
    }

setupRecognizer

    public void setupRecognizer(File assetsDir)
    {
        Config c = Decoder.DefaultConfig();

        File AccousticModel = new File(assetsDir, "de-de-ptm");
        File menuGrammar = new File("sdcard/Android/data/App3.App3/files/sync/digits.gram");


        c.SetString("-dict", "sdcard/Android/data/App3.App3/files/sync/keyphrase.dict");
        c.SetString("-hmm", "sdcard/Android/data/App3.App3/files/sync/de-de-ptm");
        c.SetString("-lm", "sdcard/Android/data/App3.App3/files/sync/corpus.dmp");

        c.SetString("-keyphrase", "hallo");
        c.SetFloat("-kws_threshold", 1e-30);

        speechrecognizer = new SpeechRecognizer(c);
        speechrecognizer.AddListener(this);

        //speechrecognizer.SetKws("digits", menuGrammar.ToString());

    }

doInBackground& OnPostExecute(在onCreate中作为任务执行)

     protected Java.Lang.Object DoInBackground(params Java.Lang.Object[] 
     @params)
    {
        try
        {
            Assets assets = new Assets();
            File assetDir = new File("Assets");

            setupRecognizer(assetDir);
        }
        catch (IOException e)
        {
            return e.ToString();
        }
        return null;
    }

    protected void OnPostExecute(Java.Lang.Object result)
    {
        if (result == null)
        {
            Label.Text = "Failed to init recognizer " + result;

        }
        else
        {
            switchSearch(KWSS_SEARCH5);
        }
    }

以下是错误消息:

 07-26 12:33:09.209 E/mono-rt (19612): /proc/self/maps:
 07-26 12:33:09.209 E/mono-rt (19612): 12c00000-12e01000 rw-p 00000000 00:04           10235 /dev/ashmem/dalvik-main space (deleted)
 .
 .
 .
 07-26 12:33:09.248 E/mono-rt (19612): b6f48000-b6f49000 r--p 00002000 b3:17      2180 /system/bin/app_process32
 07-26 12:33:09.248 E/mono-rt (19612): b6f49000-b6f4a000 rw-p 00000000 00:00      0 
 07-26 12:33:09.248 E/mono-rt (19612): be3ad000-be3ad000 ---p 00000000 00:00      0 
 07-26 12:33:09.248 E/mono-rt (19612): be3ad000-bebac000 rw-p 00000000 00:00      0 [stack]
 07-26 12:33:09.248 E/mono-rt (19612): ffff0000-ffff1000 r-xp 00000000 00:00      0 [vectors]
 07-26 12:33:09.248 E/mono-rt (19612): 
 07-26 12:33:09.248 E/mono-rt (19612): No native Android stacktrace (see      debuggerd output).
 07-26 12:33:09.248 E/mono-rt (19612): 
 07-26 12:33:09.248 E/mono-rt (19612): 
 07-26 12:33:09.248 E/mono-rt (19612):      =================================================================
 07-26 12:33:09.248 E/mono-rt (19612): Got a SIGSEGV while executing native      code. This usually indicates
 07-26 12:33:09.248 E/mono-rt (19612): a fatal error in the mono runtime or      one of the native libraries 
 07-26 12:33:09.248 E/mono-rt (19612): used by your application.
 07-26 12:33:09.248 E/mono-rt (19612):      =================================================================
 07-26 12:33:09.248 E/mono-rt (19612): 
 07-26 12:33:09.248 F/libc (19612): Fatal signal 11 (SIGSEGV), code 1, fault      addr 0xc in tid 19679 (Thread-7218)

0 个答案:

没有答案