Konrad
Konrad

Reputation: 103

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

I'm trying to build an apk for a simple python3/kivy app using buildozer in the virtual machine I got straight from kivy.org, this is day2 and still no luck. I had many errors, instaled pip, updated buildozer, pip installed morse, pnglab, sh, appdirs, setuptools for py3, but now I got this error and I must admit it really got me, anyone know what is this about? I would very much apreciate an answer as I am planning to make droid development my job some day, thank you. This is the error:
AttributeError: 'Context' object has no attribute 'hostpython'

And the traceback:

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
#

Upvotes: 2

Views: 2405

Answers (3)

Big Zak
Big Zak

Reputation: 1100

Actually for the python3 the requirement will be

requirements = kivy,python3crystax

and you would require Crytax NDK (https://www.crystax.net/en/android/ndk) instead of android NDK

Upvotes: 1

John Woods
John Woods

Reputation: 21

kivy 1.9 If you code in python 2 in your buildozer.spec file

requirements = kivy,python2

for python3 requirements = kivy,python3

Upvotes: 2

inclement
inclement

Reputation: 29488

This arises from a bug in the new python-for-android toolchain (which the android_new buildozer target uses). You can work around it by adding your python version target to the requirements, e.g. requirements = kivy,python2.

Upvotes: 8

Related Questions