python - 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 导出我希望朋友能帮助我。
解决方案
推荐阅读
- c# - 用于 gRPC 服务的 ASP.NET Core MVC 过滤器模拟
- vue.js - Vue:foreach组件中的不同方法
- azure - Powershell 命令查找访问和刷新令牌时间
- django - Django 在 request.POST.get() 中返回变量名而不是值
- java - Swing JFrame.setDefaultLookAndFeelDecorated vs UIManager.setLookAndFeel
- ruby-on-rails - 仅导入主文件时,SASS 变量不起作用
- c# - 不带参数的存储过程更新数据库表
- ssis - “缓冲区大小”和“最大行数”与多个源和目标流“每批次的行数”和“插入提交大小”的关系是什么?
- python - 基于两个条件的 Python pandas 数据帧回填
- jquery - 计算附加了子 div 的多个父 div