亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

將 Python 版本和要求放入 buildozer spec 文件的正確方法是什么?

將 Python 版本和要求放入 buildozer spec 文件的正確方法是什么?

尚方寶劍之說 2023-03-08 17:18:13
當使用buildozer為 Android 或 iOS 構建 Kivy 應用程序時,這確實令人困惑。文檔中沒有提供將依賴項和要求放入 buildozer 規范文件的正確方法。現在我使用 Kivy 框架構建了一個應用程序,我想構建一個 .apk 文件以將其部署到 Android 上。我正在使用 buildozer 構建 apk 文件,因為它是文檔中所示的推薦方式。該應用程序在我的筆記本電腦上運行完美,并且 buildozer 日志沒有顯示任何錯誤,事實上,它讓我在工作結束時成功構建。不幸的是,在我的 Android 手機上部署 apk 文件并安裝后,該應用程序崩潰了。UI根本不顯示,點擊圖標后應用程序直接崩潰。由于沒有日志錯誤,我假設這與我構建應用程序的方式或更準確地說是 buildozer 規范文件有關。這是我的 buildozer 規范文件:[app]# (str) Title of your applicationtitle = Overall Translator# (str) Package namepackage.name = overallTranslator# (str) Package domain (needed for android/ios packaging)package.domain = org.nidhal.overallTranslator# (str) Source code where the main.py livesource.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 matchingsource.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,kivyrequirements = 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 的庫,我如何在要求中提供它?我在上面的規范文件中以正確的方式進行操作嗎?
查看完整描述

1 回答

?
躍然一笑

TA貢獻1826條經驗 獲得超6個贊

將 python 版本和要求放入 buildozer spec 文件的正確方法是什么?

對此的直接回答是使用 buildozer.spec 行的“您完成它的方式” requirements = hostpython3==3.7.8,python3==3.7.8。唯一需要注意的是,并不是所有的 python 小版本都一定能用,我不知道 3.7.8 好不好。如果可能,最好使用默認值,在這種情況下,這將使用 Python 3.8(但您需要清理構建并再次運行以實現此目的)。但是,您遇到的主要問題是不良的次要版本會導致編譯失敗,因此這可能不是您的問題。

您的問題顯然是“為什么我的應用程序崩潰了?”。我建議單獨詢問該問題并包括完整的 logcat 輸出。這可能比猜測原因并詢問原因更有成效。


查看完整回答
反對 回復 2023-03-08
  • 1 回答
  • 0 關注
  • 486 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號