Kallz
Kallz

Reputation: 3523

Making android application in python using buildozer and kivy

I am trying to build apk by using buildozer. But when I run buildozer -v android debug Command to build apk I got following error

[INFO]:    Building python2 for armeabi-v7a
[INFO]:    Copying hostpython binary to targetpython folder
[INFO]:    -> running cp /home/kallz/Project/AndroidLib/examples/FaceD/.buildozer/android/platform/build/build/other_builds/hostpython2/deskto...(and 148 more)  
[INFO]:    Building sdl2 for armeabi-v7a
[INFO]:    -> directory context /home/kallz/Project/AndroidLib/examples/FaceD/.buildozer/android/platform/build/build/bootstrap_builds/sdl2-python2/jni
[INFO]:    -> running ndk-build V=1
Exception in thread background thread for pid 5175:
Traceback (most recent call last):
 File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
 self.run()
File "/usr/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/kallz/.local/lib/python2.7/site-packages/sh.py", line 2170, in background_thread
handle_exit_code(exit_code)
File "/home/kallz/.local/lib/python2.7/site-packages/sh.py", line 1929, in fn
return self.command.handle_command_exit_code(exit_code)
File "/home/kallz/.local/lib/python2.7/site-packages/sh.py", line 672, in handle_command_exit_code
raise exc
ErrorReturnCode_255: 

RAN: /home/kallz/.buildozer/android/platform/android-ndk-r9c/ndk-build V=1

STDOUT:


STDERR:


Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 174, 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/kallz/Project/AndroidLib/examples/FaceD/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 916, in <module>
main()
File "/home/kallz/Project/AndroidLib/examples/FaceD/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 913, in main
ToolchainCL()
File "/home/kallz/Project/AndroidLib/examples/FaceD/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 514, in __init__
getattr(self, args.subparser_name.replace('-', '_'))(args)
File "/home/kallz/Project/AndroidLib/examples/FaceD/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 147, in wrapper_func
build_dist_from_args(ctx, dist, args)
File "/home/kallz/Project/AndroidLib/examples/FaceD/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 192, in build_dist_from_args
build_recipes(build_order, python_modules, ctx)
File "pythonforandroid/build.py", line 572, in build_recipes
File "/home/kallz/Project/AndroidLib/examples/FaceD/.buildozer/android/platform/python-for-android-master/pythonforandroid/recipes/sdl2/__init__.py", line 30, in build_arch
shprint(sh.ndk_build, "V=1", _env=env)
File "pythonforandroid/logger.py", line 175, in shprint
File "/home/kallz/.local/lib/python2.7/site-packages/sh.py", line 720, in next
self.wait()
File "/home/kallz/.local/lib/python2.7/site-packages/sh.py", line 651, in wait
self.handle_command_exit_code(exit_code)
File "/home/kallz/.local/lib/python2.7/site-packages/sh.py", line 672, in handle_command_exit_code
raise exc
sh.ErrorReturnCode_255: 

RAN: /home/kallz/.buildozer/android/platform/android-ndk-r9c/ndk-build V=1

STDOUT:


STDERR:

# Command failed: /usr/bin/python2.7 -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=kivy,pyjnius,hostpython2,python2,plyer --arch armeabi-v7a --copy-libs --color=always --storage-dir=/home/kallz/Project/AndroidLib/examples/FaceD/.buildozer/android/platform/build

# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2

I am using python 2.7 ubuntu 17 and I already tried Buildozer 0.32 fails to build

I don`t know what is missing. Thanks in advance

Upvotes: 3

Views: 1059

Answers (1)

Kallz
Kallz

Reputation: 3523

Find solution myself

Error:

The error is in building sdl2 for armeabi-v7a ,because your current version of sdk ndk or ndk in .buildozer has incomplete downloaded or some other error

Building sdl2 for armeabi-v7a
[INFO]:    -> directory context /home/kallz/Project/AndroidLib/examples/FaceD/.buildozer/android/platform/build/build/bootstrap_builds/sdl2-python2/jni
[INFO]:    -> running ndk-build V=1
Exception in thread background thread for pid 5175:
Traceback (most recent call last):

Solution:

  1. delete .buildozer directory in the home directory for Linux( where android SDK ndk or ant installed)
  2. delete .buildozer directory from your project or app
  3. delete buildozer.spec file

Now start again, run following command in project directory

  1. buildozer init
  2. buildozer -v android debug # to make the only apk

Last command auto download sdk ndk or ant again in .buildozer in home directory

Upvotes: 1

Related Questions