У Kivy есть проблема после завершения работы приложения компиляции - PullRequest
0 голосов
/ 25 января 2020

Я написал небольшое приложение Android, которое использует модуль zbarcam (штрих-коды), приложение просто считывает штрих-коды и сохраняет их в файл. Все отлично работает на компьютере, но после компиляции под Adroid, после запуска приложение закрывается. Я проследил logcat: и ошибка связана с модулем, якобы его там нет, он не загружен, хотя при компиляции ошибок нет. Помогите помучить меня на 4 дня. !!! Что делать или куда вставлять этот модуль, я указал модуль zbarcam в файле spe c. Странно, что не запускается. Несмотря на то, что при компиляции ошибок нет!

Вот logcat:

01-25 19:33:29.136 4466 4520 I python : Initializing Python for Android
01-25 19:33:29.136 4466 4520 I python : Setting additional env vars from p4a_env_vars.txt
01-25 19:33:29.140 4466 4520 I python : Changing directory to the one provided by ANDROID_ARGUMENT
01-25 19:33:29.140 4466 4520 I python : /data/user/0/com.soft.amour.dkcam/files/app
01-25 19:33:29.166 4466 4520 I python : Preparing to initialize python
01-25 19:33:29.167 4466 4520 I python : _python_bundle dir exists
01-25 19:33:29.547 4466 4520 I python : Android kivy bootstrap done. __name__ is __main__
01-25 19:33:29.547 4466 4520 I python : AND: Ran string
01-25 19:33:29.547 4466 4520 I python : Run user program, change dir and execute entrypoint
01-25 19:33:30.421 4466 4520 I python : [INFO ] [Logger ] Record log in /data/user/0/com.soft.amour.dkcam/files/app/.kivy/logs/kivy_20-01-25_5.txt
01-25 19:33:30.422 4466 4520 I python : [INFO ] [Kivy ] v1.11.1
01-25 19:33:30.423 4466 4520 I python : [INFO ] [Kivy ] Installed at "/data/user/0/com.soft.amour.dkcam/files/app/_python_bundle/site-packages/kivy/__init__.pyc"
01-25 19:33:30.425 4466 4520 I python : [INFO ] [Python ] v3.7.1 (default, Jan 25 2020, 18:29:36)
01-25 19:33:30.425 4466 4520 I python : [Clang 8.0.2 (https://android.googlesource.com/toolchain/clang 40173bab62ec7462
01-25 19:33:30.427 4466 4520 I python : [INFO ] [Python ] Interpreter at "android_python"
01-25 19:33:35.259 4466 4520 I python : [INFO ] [Factory ] 184 symbols loaded
01-25 19:33:37.191 4466 4520 I python : [INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored)
01-25 19:33:37.479 4466 4520 I python : [ERROR ]
01-25 19:33:37.479 4466 4520 I python : Traceback (most recent call last):
01-25 19:33:37.479 4466 4520 I python : File "/home/beans/Desktop/N/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/dkcam/kivy/lang/parser.py", line 471, in execute_directives
01-25 19:33:37.479 4466 4520 I python : ModuleNotFoundError: No module named 'kivy_garden.zbarcam'
01-25 19:33:37.479 4466 4520 I python :
01-25 19:33:37.479 4466 4520 I python : During handling of the above exception, another exception occurred:
01-25 19:33:37.479 4466 4520 I python :
01-25 19:33:37.479 4466 4520 I python : Traceback (most recent call last):
01-25 19:33:37.479 4466 4520 I python : File "/home/beans/Desktop/N/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/dkcam/kivy/lang/parser.py", line 473, in execute_directives
01-25 19:33:37.480 4466 4520 I python : ModuleNotFoundError: No module named 'kivy_garden.zbarcam'
01-25 19:33:37.482 4466 4520 I python : Traceback (most recent call last):
01-25 19:33:37.484 4466 4520 I python : File "/home/beans/Desktop/N/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/dkcam/kivy/lang/parser.py", line 471, in execute_directives
01-25 19:33:37.487 4466 4520 I python : ModuleNotFoundError: No module named 'kivy_garden.zbarcam'
01-25 19:33:37.489 4466 4520 I python :
01-25 19:33:37.490 4466 4520 I python : During handling of the above exception, another exception occurred:
01-25 19:33:37.491 4466 4520 I python :
01-25 19:33:37.493 4466 4520 I python : Traceback (most recent call last):
01-25 19:33:37.494 4466 4520 I python : File "/home/beans/Desktop/N/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/dkcam/kivy/lang/parser.py", line 473, in execute_directives
01-25 19:33:37.497 4466 4520 I python : ModuleNotFoundError: No module named 'kivy_garden.zbarcam'
01-25 19:33:37.498 4466 4520 I python :
01-25 19:33:37.500 4466 4520 I python : During handling of the above exception, another exception occurred:
01-25 19:33:37.501 4466 4520 I python :
01-25 19:33:37.503 4466 4520 I python : Traceback (most recent call last):
01-25 19:33:37.504 4466 4520 I python : File "/home/beans/Desktop/N/.buildozer/android/app/main.py", line 42, in <module>
01-25 19:33:37.507 4466 4520 I python : File "/home/beans/Desktop/N/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/dkcam/kivy/lang/builder.py", line 368, in load_string
01-25 19:33:37.510 4466 4520 I python : File "/home/beans/Desktop/N/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/dkcam/kivy/lang/parser.py", line 401, in __init__
01-25 19:33:37.513 4466 4520 I python : File "/home/beans/Desktop/N/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/dkcam/kivy/lang/parser.py", line 507, in parse
01-25 19:33:37.516 4466 4520 I python : File "/home/beans/Desktop/N/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/dkcam/kivy/lang/parser.py", line 484, in execute_directives
01-25 19:33:37.519 4466 4520 I python : kivy.lang.parser.ParserException: Parser: File "<inline>", line 3:
01-25 19:33:37.520 4466 4520 I python : ...
01-25 19:33:37.521 4466 4520 I python : 1:
01-25 19:33:37.523 4466 4520 I python : 2:<MenuScreen>:
01-25 19:33:37.524 4466 4520 I python : » 3:#:import ZBarCam kivy_garden.zbarcam.ZBarCam
01-25 19:33:37.526 4466 4520 I python : 4:#:import ZBarSymbol pyzbar.pyzbar.ZBarSymbol
01-25 19:33:37.527 4466 4520 I python : 5:
01-25 19:33:37.528 4466 4520 I python : ...
01-25 19:33:37.530 4466 4520 I python : Unable to import package 'kivy_garden.zbarcam.ZBarCam'
01-25 19:33:37.530 4466 4520 I python : Python for android ended.

buildozer.spe c

[app]

# (str) Title of your application
title = DK CAM

# (str) Package name
package.name = dkcam

# (str) Package domain (needed for android/ios packaging)
package.domain = com.soft.amour

# (str) Source code where the main.py live
source.dir = src

# (list) Source files to include (let empty to include all the files)
source.include_exts = py,png,jpg,kv,atlas

# (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

# (list) List of directory to exclude (let empty to not exclude anything)
#source.exclude_dirs = tests, bin

# (list) List of exclusions using pattern matching
#source.exclude_patterns = license,images/*/*.jpg

# (str) Application versioning (method 1)
version = 0.1
# (list) Application requirements
# comma seperated e.g. requirements = sqlite3,kivy
requirements =
android,
kivy==1.11.1,
libiconv,
libzbar,
Pillow==5.2.0,
python3,
pyzbar==0.1.8,
xcamera==2019.928
# (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes
# requirements.source.kivy = ../../kivy
# (list) Garden requirements
#garden_requirements =
# (str) Presplash of the application
#presplash.filename = %(source.dir)s/data/presplash.png
# (str) Icon of the application
#icon.filename = %(source.dir)s/data/icon.png
# (str) Supported orientation (one of landscape, sensorLandscape, portrait or all)
orientation = portrait
# (list) List of service to declare
#services = NAME:ENTRYPOINT_TO_PY,NAME2:ENTRYPOINT2_TO_PY
#
# OSX Specific
#
#
# author = © Copyright Info
# change the major version of python used by the app
osx.python_version = 3
# Kivy version to use
osx.kivy_version = 1.9.1
#
# Android specific
#
# (bool) Indicate if the application should be fullscreen or not
fullscreen = 0

# (list) Permissions
android.permissions = CAMERA,READ_EXTERNAL_STORAGE,WRITE_EXTERNAL_STORAGE
# (int) Target Android API, should be as high as possible.
android.api = 27
# (int) Minimum API your APK will support.
android.minapi = 21
# (int) Android SDK version to use
android.sdk = 20
# (str) Android NDK version to use
android.ndk = 19b
# (int) Android NDK API to use. This is the minimum API your app will support, it should usually match android.minapi.
android.ndk_api = 21
...