Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail to open input file common.res #309

Closed
eagerowl opened this issue Nov 13, 2017 · 5 comments
Closed

Fail to open input file common.res #309

eagerowl opened this issue Nov 13, 2017 · 5 comments

Comments

@eagerowl
Copy link

eagerowl commented Nov 13, 2017

Hi,

I've successfully compiled snowboy for Android using the npm snowboy-detect source and I've created a custom pmdl file to use with it.

I'm trying to get the port to work with my custom pmdl (or even just the snowbody.umdl, neither work) but I'm receiving the following issue when instantiating the Snowboy-detect constructor with a resource file and model:

snowboyDetector = new SnowboyDetect("/sdcard/snowboy/common.res",
                "/sdcard/snowboy/snowboy.umdl");
snowboyDetector.SetSensitivity("0.45");         // Sensitivity for each hotword
snowboyDetector.SetAudioGain(2.0f);              // Audio gain for detection

But I receive the following error:

A/libc: /Volumes/Android/buildbot/out_dirs/aosp-ndk-r11-release/build/tmp/build-72234/build-libc++/ndk/sources/cxx-stl/llvm-libc++/../llvm-libc++abi/libcxxabi/src/abort_message.cpp:74: void abort_message(const char *, ...): assertion "terminating with uncaught exception of type std::runtime_error: ERROR (snowboy::Input::Input(const string&)():snowboy-io.cc:266) Fail to open input file "/sdcard/snowboy/common.res"
                                                                       
[stack trace: ]
Backtrace for Android has not been implemented yet.
" failed
11-13 23:50:19.784 9372-9372/ A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 9372 

"Fail to open input file "/sdcard/snowboy/common.res""

The path I'm using is /sdcard/snowboy/common.res and the file exists in the location.

Can anyone suggest what's wrong?

Thanks
Colin

@chenguoguo
Copy link
Collaborator

Were you able to run the Snowboy Android demo? https://github.com/Kitt-AI/snowboy/tree/master/examples/Android/SnowboyAlexaDemo

That should work, and you can start from there.

@eagerowl
Copy link
Author

Thanks for the tip, I hadn't considered that. I fixed the problem by changing two things:

  1. using the copyToSdCard method rather than placing the files manually in storage
  2. changing the targetSdkVersion to 22 from 26 to suit my device. I believe they handle permissions differently.

Thanks
Colin

@chenguoguo
Copy link
Collaborator

Thanks for letting us know. Changing the target sdk version might be critical for your device.

@Lebedinsky
Copy link

I had the same issue with common.res file on Android. For solving this issue just check 2 points:

  1. I/O File mechanism. (file AppResCopy.java in demo app)
  2. Permissions. If you are using device with Android M or above, you should request runtime permissions for READ_EXTERNAL_STORAGE, WRITE_EXTERNAL_STORAGE and RECORD_AUDIO.

@chenguoguo
Copy link
Collaborator

@Lebedinsky if you have time to submit a PR for it, that would be great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants