当使用buildozer为 Android 或 iOS 构建 Kivy 应用程序时,这确实令人困惑。文档中没有提供将依赖项和要求放入 buildozer 规范文件的正确方法。
现在我使用 Kivy 框架构建了一个应用程序,我想构建一个 .apk 文件以将其部署到 Android 上。我正在使用 buildozer 构建 apk 文件,因为它是文档中所示的推荐方式。
该应用程序在我的笔记本电脑上运行完美,并且 buildozer 日志没有显示任何错误,事实上,它让我在工作结束时成功构建。不幸的是,在我的 Android 手机上部署 apk 文件并安装后,该应用程序崩溃了。UI根本不显示,点击图标后应用程序直接崩溃。
由于没有日志错误,我假设这与我构建应用程序的方式或更准确地说是 buildozer 规范文件有关。这是我的 buildozer 规范文件:
[app]
# (str) Title of your application
title = Overall Translator
# (str) Package name
package.name = overallTranslator
# (str) Package domain (needed for android/ios packaging)
package.domain = org.nidhal.overallTranslator
# (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,jpg,kv,atlas,ttf
# (list) List of inclusions using pattern matching
source.include_patterns = assets/*,images/*.png, font/*.ttf
# (list) Source files to exclude (let empty to not exclude anything)
source.exclude_exts = spec, txt, md, gitignore
# (list) List of directory to exclude (let empty to not exclude anything)
source.exclude_dirs = tests, bin, venv
# (list) List of exclusions using pattern matching
#source.exclude_patterns = license,images/*/*.jpg
# (str) Application versioning (method 1)
#version = 0.1
# (str) Application versioning (method 2)
version.regex = __version__ = ['"](.*)['"]
version.filename = %(source.dir)s/main.py
# (list) Application requirements
# comma separated e.g. requirements = sqlite3,kivy
requirements = hostpython3==3.7.8,python3==3.7.8,kivy==1.11.1, beautifulsoup4, bs4, certifi,chardet,docutils, future, idna, Kivy-Garden, Pygments, requests, six, soupsieve, urllib3, deep-translator, arabic-reshaper, python-bidi, openssl
与任何项目一样,我的也有依赖项,我应该在规范文件中放入需求。这很令人困惑,因为没有描述如何以正确的方式做到这一点。例如,我有仅适用于 python >= 3.7 的库,我如何在要求中提供它?我在上面的规范文件中以正确的方式进行操作吗?
跃然一笑
相关分类