alphacep / vosk-android-demo

Offline speech recognition for Android with Vosk library.
Apache License 2.0
748 stars 201 forks source link

Demo on Android run perfectly,but when import into my own pro,it broken.Without log,it is so diffcult to solve it. #221

Closed mmhmofu closed 1 month ago

mmhmofu commented 2 months ago

2024-07-26 16:50:22.888 18626-18626 DEBUG pid-18626 A pid: 18586, tid: 18586, name: .mmh >>> com.mmh.test <<< 2024-07-26 16:50:22.890 18626-18626 DEBUG pid-18626 A #00 pc 000ae348 /data/app/com.mmh.test/lib/arm/libvosk.so (offset 0x2a7000) 2024-07-26 16:50:22.891 18626-18626 DEBUG pid-18626 A https://github.com/alphacep/vosk-api/issues/1 pc 00000b84 /data/app/com.mmh.test/lib/arm/libvosk.so (offset 0x2a7000)

nshmyrev commented 2 months ago

You need to read full logcat output, not just few lines

mmhmofu commented 2 months ago

You need to read full logcat output, not just few lines

yes,ur right.I debug it again.Found that StorageService.unpack(Utils.getApp(), "model-cn", "model", (model) -> { this.model = model; }, (exception) -> Log.e(TAG, "initModel: Failed to unpack the model", exception)); throw a exception.Path not found! But i just import it as my module,how can it be?

nshmyrev commented 2 months ago

Probably you put model into different path in assets

mmhmofu commented 2 months ago

Probably you put model into different path in assets

i just import the module in my pro like my own demo.But i dont use it the same way,i use it as a service on another module x.Will it be different ?

mmhmofu commented 2 months ago

Probably you put model into different path in assets

Android demo put the model into module 'models' assets path.I do it the same,but it cant recognize(java.io.FileNotFoundException: model-cn/uuid).When i copy the model into 'app' assets path,it cast another error.( Model():model.cc:122) Folder '/storage/emulated/0/Android/data/com.mmh.xxx/files/model/model-cn' does not contain model files. Make sure you specified the model path properly in Model constructor. If you are not sure about relative path, use absolute path specification. java.io.IOException: Failed to create a model)

mmhmofu commented 2 months ago

Probably you put model into different path in assets

found out the error happend when assetManager.open(model-cn/uuid) $QV9%Y AZ E)`L498_NP{_5

mmhmofu commented 2 months ago

Probably you put model into different path in assets

when i move assets all to 'app' module.It can correctly find model,but it cast to 'ExpectToken():io-funcs.cc:200) Failed to read token [started at file position -1], expected ',failed to create a model.

mmhmofu commented 2 months ago

Probably you put model into different path in assets

when i move assets all to 'app' module.It can correctly find model,but it cast to 'ExpectToken():io-funcs.cc:200) Failed to read token [started at file position -1], expected ',failed to create a model.

i rebuild it,it worked. but i still confused that the model in other module like demo didnt worked!