Kivy Buildozer AttributeError: 'Context' object has no attribute 'hostpython'

Kivy Buildozer AttributeError: 'Context' object has no attribute 'hostpython'

我正在尝试在我直接从 kivy.org 获得的虚拟机中使用 buildozer 为一个简单的 python3/kivy 应用程序构建一个 apk,这是第 2 天,仍然没有运气。我有很多错误,安装了 pip,更新了 buildozer,pip 安装了 morse,pnglab,sh,appdirs,py3 的 setuptools,但现在我得到了这个错误,我必须承认它真的让我明白了,有人知道这是怎么回事吗?我非常感谢您的回答,因为我计划有一天将机器人开发作为我的工作,谢谢。这是错误:
AttributeError: 'Context' 对象没有属性 'hostpython'

以及回溯:

Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main "__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals
File "/home/kivy/Desktop/TextEditor/.buildozer/android/platform/python-for android-master/pythonforandroid/toolchain.py", line 747, in <module> main()
File "/home/kivy/Desktop/TextEditor/.buildozer/android/platform/python-for android-master/pythonforandroid/toolchain.py", line 744, in main ToolchainCL()
File "/home/kivy/Desktop/TextEditor/.buildozer/android/platform/python-for android-master/pythonforandroid/toolchain.py", line 323, in __init__ getattr(self, args.command)(unknown)
File "/home/kivy/Desktop/TextEditor/.buildozer/android/platform/python-for android-master/pythonforandroid/toolchain.py", line 105, in wrapper_func build_dist_from_args(ctx, dist, dist_args)
File "/home/kivy/Desktop/TextEditor/.buildozer/android/platform/python-for android-master/pythonforandroid/toolchain.py", line 142, in build_dist_from_args build_recipes(build_order, python_modules, ctx)
File "pythonforandroid/build.py", line 560, in build_recipes recipe.build_arch(arch)
File "/home/kivy/Desktop/TextEditor/.buildozer/android/platform/python-for android-master/pythonforandroid/recipes/python2/__init__.py", line 44, in build_arch self.do_python_build(arch)
File "/home/kivy/Desktop/TextEditor/.buildozer/android/platform/python-for android-master/pythonforandroid/recipes/python2/__init__.py", line 76, in do_python_build shprint(sh.cp, self.ctx.hostpython, self.get_build_dir(arch.arch))
AttributeError: 'Context' object has no attribute 'hostpython'
# Command failed: python -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=kivy --arch armeabi-v7a --copy-libs
#

这是由新的 python-for-android 工具链(android_new buildozer 目标使用的)中的错误引起的。您可以通过将 python 版本目标添加到要求中来解决它,例如requirements = kivy,python2.

基维 1.9 如果您在 buildozer.spec 文件

中的 python 2 中编码

要求=kivy,python2

对于 python3 要求 = kivy,python3

实际上 python3 的要求是

requirements = kivy,python3crystax

并且您需要 Crytax NDK (https://www.crystax.net/en/android/ndk) 而不是 android NDK