kivy / plyer

Plyer is a platform-independent Python wrapper for platform-dependent APIs
https://plyer.readthedocs.io
MIT License
1.61k stars 427 forks source link

app closes when i press the listen button #569

Closed nancygeorge1997 closed 11 months ago

nancygeorge1997 commented 4 years ago

I created my kivy app (speech to text) using buildozer . my app crashes every time i press the listen button , those are the logs generated when i run the app

import imp [INFO]: Will compile for the following archs: armeabi-v7a [INFO]: Found Android API target in $ANDROIDAPI: 27 [INFO]: Available Android APIs are (27) [INFO]: Requested API target 27 is available, continuing. [INFO]: Found NDK dir in $ANDROIDNDK: /home/rom/.buildozer/android/platform/android-ndk-r19c [INFO]: Found NDK version 19c [INFO]: Getting NDK API version (i.e. minimum supported API) from user argument [INFO]: ccache is missing, the build will not be optimized in the future. [INFO]: Found the following toolchain versions: ['4.9'] [INFO]: Picking the latest gcc toolchain, here 4.9 [INFO]: Of the existing distributions, the following meet the given requirements: [INFO]: myapp: min API 21, includes recipes (hostpython3, libffi, openssl, sdl2_image, sdl2_mixer, sdl2_ttf, sqlite3, python3, sdl2, setuptools, six, pyjnius, android, kivy, certifi), built for archs (armeabi-v7a) [INFO]: myapp has compatible recipes, using this one [INFO]: Of the existing distributions, the following meet the given requirements: [INFO]: myapp: min API 21, includes recipes (hostpython3, libffi, openssl, sdl2_image, sdl2_mixer, sdl2_ttf, sqlite3, python3, sdl2, setuptools, six, pyjnius, android, kivy, certifi), built for archs (armeabi-v7a) [INFO]: myapp has compatible recipes, using this one [INFO]: -> directory context /home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/build/bootstrap_builds/sdl2 [INFO]: <- directory context /home/rom/Desktop/.buildozer/android/platform/python-for-android [INFO]: -> directory context /home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a Listing '/tmp/p4a-extra-env-3reqpy'... Listing '/home/rom/Desktop/.buildozer/android/app'... Listing '/home/rom/Desktop/.buildozer/android/app/_applibs'... Compiling '/home/rom/Desktop/.buildozer/android/app/main.py'... Compiling '/home/rom/Desktop/.buildozer/android/app/sitecustomize.py'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/modules'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/Kivy-1.11.1-py3.8.egg-info'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/android'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/certifi'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/certifi-2020.6.20.dist-info'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/jnius'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/jnius/src'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/jnius/src/org'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/jnius/src/org/jnius'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/core'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/core/audio'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/core/camera'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/core/clipboard'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/core/gl'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/core/image'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/core/spelling'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/core/text'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/core/video'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/core/window'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/data'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/data/fonts'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/data/glsl'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/data/images'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/data/keyboards'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/data/logo'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/deps'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/effects'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/extras'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/garden'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/graphics'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/graphics/cgl_backend'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/include'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/input'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/input/postproc'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/input/providers'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/lang'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/lib'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/lib/gstplayer'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/lib/vidcore_lite'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/modules'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/network'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/storage'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/tools'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/tools/gles_compat'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/tools/highlight'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/tools/packaging'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/tools/packaging/pyinstaller_hooks'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/tools/pep8checker'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/tools/theming'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/tools/theming/defaulttheme'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/uix'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/uix/behaviors'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/kivy/uix/recycleview'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapp__armeabi-v7a/_python_bundle/_python_bundle/site-packages/pkg_resources'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/pkg_resources/_vendor'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/pkg_resources/_vendor/packaging'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/pkg_resources/extern'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/pyjnius-1.2.1-py3.8.egg-info'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/setuptools'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/setuptools/_vendor'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapp__armeabi-v7a/_python_bundle/_python_bundle/site-packages/setuptools/_vendor/packaging'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/setuptools/command'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/setuptools/extern'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/setuptools-40.9.0-py3.8.egg-info'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/usr'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/usr/local'... Listing '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/_python_bundle/_python_bundle/site-packages/usr/local/bin'... [INFO]: Detected highest available build tools version to be 30.0.0 [DEBUG]: -> running gradlew assembleDebug [DEBUG]: Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details [DEBUG]: ebugJ> Task :compileDebugJavaWithJavac [DEBUG]: uild-Note: Some input files use or override a deprecated API. [DEBUG]: Note: Recompile with -Xlint:deprecation for details. [DEBUG]: Note: Some input files use unchecked or unsafe operations. [DEBUG]: Note: Recompile with -Xlint:unchecked for details. [DEBUG]:
[DEBUG]: > Task :transformNativeLibsWithStripDebugSymbolForDebug [DEBUG]: /home/rom/.buildozer/android/platform/android-ndk-r19c/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-strip:/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapp__armeabi-v7a/build/intermediates/transforms/mergeJniLibs/debug/0/lib/armeabi-v7a/gdb.setup: File format not recognized [DEBUG]:
[DEBUG]: Unable to strip library '1' due to error /home/rom/.buildozer/android/platform/android-ndk-r19c/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-strip returned from '/home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapp
armeabi-v7a/build/intermediates/transforms/mergeJniLibs/debug/0/lib/armeabi-v7a/gdb.setup', packaging it as is. [DEBUG]:
[DEBUG]: Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0. [DEBUG]: Use '--warning-mode all' to show the individual deprecation warnings. [DEBUG]: See https://docs.gradle.org/6.4.1/userguide/command_line_interface.html#sec:command_line_warnings [DEBUG]:
[DEBUG]: BUILD SUCCESSFUL in 1m 26s [DEBUG]: 27 actionable tasks: 27 executed [INFO]: <- directory context /home/rom/Desktop/.buildozer/android/platform/python-for-android [INFO]: Of the existing distributions, the following meet the given requirements: [INFO]: myapp: min API 21, includes recipes (hostpython3, libffi, openssl, sdl2_image, sdl2_mixer, sdl2_ttf, sqlite3, python3, sdl2, setuptools, six, pyjnius, android, kivy, certifi), built for archs (armeabi-v7a) [INFO]: myapp has compatible recipes, using this one [INFO]: # Copying android package to current directory [INFO]: # Android package filename not found in build output. Guessing... [INFO]: # Found android package file: /home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/build/outputs/apk/debug/myapparmeabi-v7a-debug.apk [INFO]: # Add version number to android package [INFO]: # Android package renamed to myapparmeabi-v7a-debug-0.1-.apk [DEBUG]: -> running cp /home/rom/Desktop/.buildozer/android/platform/build-armeabi-v7a/dists/myapparmeabi-v7a/build/outputs/apk/debug/myapparmeabi-v7a-debug.apk myapparmeabi-v7a-debug-0.1-.apk WARNING: Received a --sdk argument, but this argument is deprecated and does nothing. No setup.py/pyproject.toml used, copying full private data into .apk. Applying Java source code patches... Applying patch: src/patches/SDLActivity.java.patch

Android packaging done!

APK myapp-0.1-armeabi-v7a-debug.apk available in the bin directory

Run '/home/rom/.buildozer/android/platform/android-sdk/platform-tools/adb devices'

Cwd None

ghost commented 4 years ago

Hello

The log you put in this issue is hard to read because GitHub converted the text into a markdown-style. You can use three backticks (`) to quote all the code (more info here).

Also, this output seems to be the buildozer log when the app is being built and installed. To get the log of the app when it's running, you need to use the logcat option (buildozer android logcat). To filter the python output, append -s python to the command.

Python3-8 commented 4 years ago

Hi, this is the log that Buildozer generated for you. Also, Buildozer often puts hashtags (#) in front of words. So GitHub converted the log that you pasted into Markdown. That's why the log you have provided was hard to read. Please remember that you can just quote all the code (<code></code>) by adding three backticks (```) to the front and back of the log.

If you want to find out what's wrong with your app, then:

Now you'll know what error caused your app to crash. I'm thinking it might be something like a PermissionError. If it is, you'll need to add the RECORD_AUDIO permission to your buildozer.spec file and request the permission from your app by adding:

# OTHER IMPORTS (e.g., "from kivy.app import App" or "from kivymd.app import MDApp")
from android.permissions import request_permissions, Permission
# APP CODE (e.g., "class MyApp(App): ..." or "class MyApp(MDApp): ...")
if __name__ in ['__android__', '__main__']:
 request_permissions([Permission.RECORD_AUDIO])
 # LAUNCH APP (e.g., "MyApp().run()")

to your code. You don't have to worry about the android module, because Buildozer automatically adds it to your APK. Now if you run your app on your Android device, you will be asked if you want to allow this app to record audio.

Sorry if my comment is too long. But I hope it helps!