首页 > 解决方案 > android kivy 的错误生成器导出 apk

问题描述

我有一个与其他库一起处理 opencv 和 numpy 的代码。事实证明,当我将 apk 导出到 android 并在 android 中运行应用程序时,它会立即加载并关闭,我在 android 中执行 logcat 并收到以下错误:

    07-04 12:12:21.207 10072 10098 I python  : [INFO   ] [Text        ] Provider: sdl2
    07-04 12:12:21.283 10072 10098 I python  : [INFO   ] [GL          ] NPOT texture support is available
    07-04 12:12:21.434 10072 10098 I python  :  Traceback (most recent call last):
    07-04 12:12:21.434 10072 10098 I python  :    File "/home/dev-chavita/Documentos/Alcoholimtro/alcoholimetro/.buildozer/android/app/main.py", line 9, in <module>
    07-04 12:12:21.435 10072 10098 I python  :    File "/home/dev-chavita/Documentos/Alcoholimtro/alcoholimetro/.buildozer/android/app/views/camLoad.py", line 8, in <module>
    07-04 12:12:21.435 10072 10098 I python  :  ModuleNotFoundError: No module named 'cv2'
    07-04 12:12:21.435 10072 10098 I python  : Python for android ended.
    07-04 12:12:21.493  1674  2449 W InputDispatcher: channel '391dce6 org.test.myalcoholimetro/org.kivy.android.PythonActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9

我在.spec中有以下配置:

# (list) Application requirements
# comma separated e.g. requirements = sqlite3,kivy
requirements = python3,kivy,kivymd,opencv,numpy,face_recognition

# (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes
# (list) Permissions
#android.permissions = INTERNET
android.permissions = CAMERA
android.permission-group = HARDWARE_CONTROLS

# (int) Target Android API, should be as high as possible.
#android.api = 27

我不知道会发生什么,因为我生成了一个 cv2 错误,如果我从 .spec opencv 导出我希望朋友能帮助我。

标签: pythonpython-3.xopencvkivy

解决方案


推荐阅读