我试图在我从kivy.org直接使用的虚拟机中使用buildozer为一个简单的python3 / kivy应用程序构建一个apk,这是day2但仍然没有运气。我有很多错误,instaled pip,更新的buildozer,pip安装morse,pnglab,sh,appdirs,pyto的setuptools,但是现在我收到了这个错误,我必须承认它真的有我,有人知道这是关于什么的吗?我非常想回答一个问题,因为我计划有一天将机器人开发作为我的工作,谢谢。这是错误:
AttributeError:'上下文' object没有属性' 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
#
答案 0 :(得分:8)
这是因为新的python-for-android工具链(android_new
buildozer目标使用的)中的一个错误。您可以通过将python版本目标添加到需求中来解决此问题,例如: requirements = kivy,python2
。
答案 1 :(得分:2)
kivy 1.9 如果你在buildozer.spec文件中的python 2中编码
requirements = kivy,python2
用于python3 requirements = kivy,python3
答案 2 :(得分:1)
实际上对于python3,要求将是
Computer Name: Computer1
Conversion Status: Fully Encrypted
Protection Status: Protection On
Computer Name: Computer2
Conversion Status: Fully Encrypted
Protection Status: Protection Off
Computer Name: Computer3
Conversion Status: Fully Decrypted
Protection Status: Protection Off
Conversion Status: Fully Encrypted
Protection Status: Protection On
你需要Crytax NDK(https://www.crystax.net/en/android/ndk)而不是android NDK