加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

使用Python-For-Android将Python脚本导出到Android可执行文件(.a

发布时间:2020-12-20 13:42:11 所属栏目:Python 来源:网络整理
导读:我正在尝试使用 Python for Android将我的Python脚本导出到Android可执行文件(.apk). http://python-for-android.readthedocs.org/en/latest/toolchain/#how-does-it-work https://github.com/kivy/python-for-android/ Inside the distribution (dist/defau
我正在尝试使用 Python for Android将我的Python脚本导出到Android可执行文件(.apk).

http://python-for-android.readthedocs.org/en/latest/toolchain/#how-does-it-work

https://github.com/kivy/python-for-android/

Inside the distribution (dist/default by default),you have a tool
named build.py. This is the script that will create the APK for you

我已经执行了所有步骤,但是我遇到了一个问题:创建的dist / default文件夹不包含任何build.py.它是空的.

有什么问题 ?我该如何解决?请帮忙 !

解决方法

所以,基本上,你正在使用buildozer,它现在正在工作.再次查看buildozer.spec文件.应该有以下几行:

# (str) Application versioning (method 1)
version.regex = __version__ = '(.*)'
version.filename = %(source.dir)s/main.py

# (str) Application versioning (method 2)
# version = 1.2.0

你想做什么,我相信(因为我必须这样做),将它们改为:

# (str) Application versioning (method 1)
# version.regex = __version__ = '(.*)'
# version.filename = %(source.dir)s/main.py

# (str) Application versioning (method 2)
version = 1.2.0

看到我在顶部注释掉两行,并取消注释底线. (我还没有打扰自己改变’1.2.0′,所以不知道这是否有所作为.它不应该.)问题似乎是buildozer在py文件中查找一行,__ version__ =某事,并且在找不到它时会出错.我尝试将此行添加到我的python中,但它仍然无法正常工作.然而,这种变化确实奏效了.

另外,尝试使用详细信息运行构建,这样您就可以确切地看到导致任何错误的原因,例如:

sudo buildozer --verbose android debug deploy run

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读