我正在尝试使用buildozer构建apk。但是当我运行buildozer -v android debug命令来构建apk时,出现以下错误

[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


我正在使用python 2.7 ubuntu 17并且已经尝试过Buildozer 0.32 fails to build

我不知道缺少什么。
提前致谢

最佳答案

自己找到解决方案

错误:

错误是为armeabi-v7a构建sdl2,因为您当前版本的sdk ndk或.buildozer中的ndk下载不完整或其他错误

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):


解:


删除Linux主目录中的.buildozer目录(已安装android SDK ndk或ant)
从您的项目或应用程序中删除.buildozer目录
删除buildozer.spec文件


现在再次开始,在项目目录中运行以下命令


编译器初始化
buildozer -v android debug#使唯一的apk


最后一条命令在主目录的.buildozer中再次自动下载sdk ndk或ant

关于android - 使用buildozer和kivy在python中制作android应用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/46127824/

10-12 23:49