I have been through the wringer trying to get Voice Recognition for an Android App i'm developing on my MacOS 12.7, using Python3.10, Kivy2.3, speechrecognition requirement, and Vosk 3.44, ive been using Buildozer quite well with other versions and apps.. i've tried using it with flac, ffmpeg, all others i could come to, but Vosk seems to be the closest way so far. i have narrowed the biggest issue down to Andorids SELinux security. without compiling an independent flac or anything for myself (which is a bit more). I would like to use Vosk. Here is a summary of my information: buildozer 1.5 Kivy 2.3 Python 3.10 Vosk 3.44 MacOS 12.7 i can load and use/run the app perfectly, other than having the Speech Recognition available.. it is the only thing left that i want to add to the App. I am using it to Search "speech recognition", for words or phrase, and then print it to the screen in my app If it finds them. pretty straught forward, just got caught up in the VR.. the python logcat displays this when i run the app (erroring on the speech recognition): 04-06 13:07:00.558 15767 15943 I python : DEBUG: Attempting standard Vosk import... 04-06 13:07:00.560 15767 15943 I python : ERROR: Standard Vosk library import failed: No module named 'srt'. 04-06 13:07:00.560 15767 15943 I python : INFO: Ensure 'vosk' is in buildozer.spec requirements and the recipe ran successfully. 04-06 13:07:00.561 15767 15943 I python : DEBUG: Attempting JNIUS/Android imports... 04-06 13:07:00.659 15767 15943 I python : DEBUG: JNIUS/Android imports successful. 04-06 13:07:00.659 15767 15943 I python : INFO: Starting AbbotApp application (__main__ block). 04-06 13:07:00.659 15767 15943 I python : DEBUG: Adding project directory to resource path: /data/data/abbot.abby/files/app 04-06 13:07:00.659 15767 15943 I python : DEBUG: Adding asset directory 'model' to resource path: /data/data/abbot.abby/files/app/model 04-06 13:07:00.659 15767 15943 I python : INFO: Creating and running AbbotApp instance... 04-06 13:07:00.660 15767 15943 I python : DEBUG: AbbotApp.__init__ starting. 04-06 13:07:00.660 15767 15943 I python : DEBUG: BibleData.__init__ called with bible_file='asvbible.txt' 04-06 13:07:00.660 15767 15943 I python : DEBUG: Found bible file at: /data/data/abbot.abby/files/app/asvbible.txt 04-06 13:07:00.660 15767 15943 I python : DEBUG: Loading Bible data from: /data/data/abbot.abby/files/app/asvbible.txt 04-06 13:07:00.876 15767 15943 I python : DEBUG: Finished loading bible data. 66 books loaded. 04-06 13:07:00.876 15767 15943 I python : DEBUG: Building list of all verses... 04-06 13:07:00.908 15767 15943 I python : DEBUG: Built 31086 verses. 04-06 13:07:00.908 15767 15943 I python : DEBUG: Bible data loaded successfully. 31086 total verses. 04-06 13:07:00.908 15767 15943 I python : DEBUG: AbbotApp.__init__ checking permissions. 04-06 13:07:00.908 15767 15943 I python : DEBUG: check_and_request_permissions called. 04-06 13:07:00.912 15767 15943 I python : INFO: All required permissions already granted. 04-06 13:07:00.912 15767 15943 I python : DEBUG: AbbotApp.__init__ finished. 04-06 13:07:00.913 15767 15943 I python : DEBUG: AbbotApp.build() called. 04-06 13:07:01.011 15767 15943 I python : [INFO ] [GL ] NPOT texture support is available 04-06 13:07:01.052 15767 15943 I python : DEBUG: AbbotApp.build() finished. 04-06 13:07:01.053 15767 15943 I python : INFO: AbbotApp.on_start() called. 04-06 13:07:01.053 15767 15943 I python : INFO: Triggering Vosk model setup from on_start. 04-06 13:07:01.053 15767 15943 I python : INFO: AbbotApp.on_start() finished. 04-06 13:07:01.054 15767 15943 I python : [WARNING] [Base ] Unknown <android> provider ***** mostly here: 04-06 13:07:01.054 15767 15943 I python : [INFO ] [Base ] Start application main loop 04-06 13:07:01.075 15767 15943 I python : DEBUG: setup_vosk_model called. 04-06 13:07:01.075 15767 15943 I python : ERROR: Vosk library components (Model/KaldiRecognizer/SetLogLevel) are None due to import failure. Cannot setup model. ---------------------------------------------------------------------------------------- the buildozer has the model directory, and it is built into the Python App to import it (correctly, within the called directory, and file *.so, among a couple of others) ---------------------------------------------------------------------------------------- partial of my buildozer.spec file: requirements = python3,python-for-android,kivy,pydub,speechrecognition,plyer,pyjnius,jnius,sdl2,sdl2_image,cython (i've also tried VARIES/many ways, including the actual versions in the requirements list - without success).. android.permissions = INTERNET, WRITE_EXTERNAL_STORAGE, RECORD_AUDIO, READ_EXTERNAL_STORAGE ETC.. ---------------------------------------------------------------------------------------- Here is the (cutdown) version of my buildozer.spec file for this app: [app] # (str) Title of your application title = ABBot2App # (str) Package name package.name = abby # (str) Package domain (needed for android/ios packaging) package.domain = abbot # (str) Source code where the main.py live source.dir = . # (list) Source files to include (let empty to include all the files) # *** source.include_exts = py,png,txt,jpg,kv,atlas,ffmpeg,ffprobe,flac # (list) List of inclusions using pattern matching source.include_patterns = assets/*,images/*.png # (list) Source files to exclude (let empty to not exclude anything) #source.exclude_exts = spec,upload.py # (list) List of directory to exclude (let empty to not exclude anything) source.exclude_dirs = test, bin, venv, bu, tryit, NDK # (list) List of exclusions using pattern matching # Do not prefix with './' #source.exclude_patterns = license,images/*/*.jpg source.exclude_patterns = release_docs.py # (str) Application versioning (method 1) version = 0.2 android.gradle_dependencies = com.android.support:appcompat-v7:28.0.0, com.android.support:design:28.0.0, com.google.android.material:material:1.0.0 #requirements = #python3==3.10.15,python-for-android==2024.1.21,kivy==2.3.0,pydub==0.25.1,speechrecognition==3.11.0,plyer,pyjnius,jnius==1.5.0,sdl2,sdl2_image#,cython==3.0.125 requirements = python3,python-for-android,kivy,pydub,speechrecognition,plyer,pyjnius,jnius,sdl2,sdl2_image,cython # (str) Icon of the application #icon.filename = %(source.dir)s/data/icon.png icon.filename = ./abbyimg.png # (list) Supported orientations # Valid options are: landscape, portrait, portrait-reverse or landscape-reverse orientation = portrait # change the major version of python used by the app osx.python_version = 3.10.15 # Kivy version to use osx.kivy_version = 2.3.0 # # Android specific # # (bool) Indicate if the application should be fullscreen or not fullscreen = 1 android.presplash_color = #555555 android.permissions = INTERNET, WRITE_EXTERNAL_STORAGE, RECORD_AUDIO, READ_EXTERNAL_STORAGE # (int) Target Android API, should be as high as possible. #31 android.api = 36 # (int) Minimum API your APK / AAB will support. #21 android.minapi = 27 # (int) Android SDK version to use #android.sdk = 20 #deprecaded and ignored # (str) Android NDK version to use #25 android.ndk = 27 # (int) Android NDK API to use. This is the minimum API your app will support, it should usually match android.minapi. #21 android.ndk_api = 27 # (bool) Use --private data storage (True) or --dir public storage (False) #android.private_storage = False # (str) Android NDK directory (if empty, it will be automatically downloaded.) android.ndk_path = /Users/garrett/Library/Android/sdk/ndk/android-ndk-r27 #android.ndk_path = /users/garrett/Library/Android/sdk/ndk/21.4.7075529 # (str) Android SDK directory (if empty, it will be automatically downloaded.) android.sdk_path = /Users/garrett/Library/Android/sdk # (str) ANT directory (if empty, it will be automatically downloaded.) android.ant_path = /Users/garrett/.buildozer/android/platform/apache-ant-1.9.4 android.jdk_path = /Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home # (bool) If True, then skip trying to update the Android sdk # This can be useful to avoid excess Internet downloads or save time # when an update is due and you just want to test/build your package android.skip_update = False # (bool) If True, then automatically accept SDK license # agreements. This is intended for automation only. If set to False, # the default, you will be shown the license when first running # buildozer. android.accept_sdk_license = True android.gradle_max_heap_size = 4092m # (list) Gradle dependencies to add #android.gradle_dependencies = # (bool) Enable AndroidX support. Enable when 'android.gradle_dependencies' # contains an 'androidx' package, or any package from Kotlin source. # android.enable_androidx requires android.api >= 28 android.enable_androidx = True android.manifest.orientation = portrait # (list) Android additional libraries to copy into libs/armeabi #android.add_libs_armeabi = libs/android/*.so # *** #android.add_libs_armeabi_v7a = libs/android-v7/*.so android.add_libs_arm64_v8a = libs/android-v8/*.so # (list) The Android archs to build for, choices: armeabi-v7a, arm64-v8a, x86, x86_64 # In past, was `android.arch` as we weren't supporting builds for multiple archs at the same time. android.archs = arm64-v8a #,armeabi-v7a # (bool) enables Android auto backup feature (Android API >=23) android.allow_backup = True # (str) python-for-android branch to use, defaults to master # *** p4a.branch = master # (str) python-for-android specific commit to use, defaults to HEAD, must be within p4a.branch # *** p4a.commit = HEAD # (str) The directory in which python-for-android should look for your own build recipes (if any) # *** p4a.local_recipes = ./p4a-recipes # (str) Filename to the hook for p4a # *** p4a.hook = post-build-hook.py # (str) Bootstrap to use for android builds # *** p4a.bootstrap = sdl2 [buildozer] # (int) Log level (0 = error only, 1 = info, 2 = debug (with command output)) log_level = 2 # (int) Display warning if buildozer is run as root (0 = False, 1 = True) warn_on_root = 1 the other "warning" i receive is on my App when i load it, it simply says, Vosk library import failed.. that is coded into my main.py file. Continue reading...