我无法通过 buildozer 生成 APK

Posted

技术标签:

【中文标题】我无法通过 buildozer 生成 APK【英文标题】:I can't generate APK by buildozer 【发布时间】:2020-07-05 12:06:35 【问题描述】:

我正在使用 Kivy 创建应用程序。现在,我想在我的智能手机中测试该应用程序,但我无法生成 apk。下面的代码是在 Linux (opensuse) 中。

是否需要安装更多依赖项?我认为错误出现在以下代码的末尾。我怎样才能理解发生了什么?

这里,显示给我的消息:

leonardo@linux-eu06://home/leonardo/program> buildozer -v android debug
# Check configuration tokens
# Ensure build layout
# Check configuration tokens
# Preparing build
# Check requirements for android
# Run 'dpkg --version'
# Cwd None
/bin/sh: dpkg: command not found
# Search for Git (git)
#  -> found at /usr/lib/git/git
# Search for Cython (cython)
#  -> found at /usr/bin/cython
# Search for Java compiler (javac)
#  -> found at /usr/lib64/jvm/java-1.8.0-openjdk-1.8.0/bin/javac
# Search for Java keytool (keytool)
#  -> found at /usr/lib64/jvm/java-1.8.0-openjdk-1.8.0/jre/bin/keytool
# Install platform
# Run 'git config --get remote.origin.url'
# Cwd /home/leonardo/program/.buildozer/android/platform/python-for-android
https://github.com/kivy/python-for-android.git
# Run 'git branch -vv'
# Cwd /home/leonardo/program/.buildozer/android/platform/python-for-android
* master b1f6064d [origin/master] Release 2019.10.06 (#1998)
# Run '/usr/bin/python3 -m pip install -q --user \'appdirs\' \'colorama>=0.3.3\' \'jinja2\' \'six\' \'enum34; python_version<"3.4"\' \'sh>=1.10; sys_platform!="nt"\' \'pep517<0.7.0"\' \'pytoml\' \'virtualenv\''
...............

    return self.__env[name]
  File "/usr/lib/python3.6/site-packages/sh.py", line 3226, in __getitem__
    raise CommandNotFound(k)
sh.CommandNotFound: patch
# Command failed: /usr/bin/python3 -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=python3,kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir="/home/leonardo/program/.buildozer/android/platform/build-armeabi-v7a" --ndk-api=21                                                      
# ENVIRONMENT:
#     GS_LIB = '/home/leonardo/.fonts'
#     KDE_FULL_SESSION = 'true'
#     LS_COLORS = 'no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.xz=00;31:*.avi=01;35:*.bmp=01;35:*.dl=01;35:*.fli=01;35:*.gif=01;35:*.gl=01;35:*.jpg=01;35:*.jpeg=01;35:*.mkv=01;35:*.mng=01;35:*.mov=01;35:*.mp4=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.svg=01;35:*.tga=01;35:*.tif=01;35:*.webm=01;35:*.webp=01;35:*.wmv=01;35:*.xbm=01;35:*.xcf=01;35:*.xpm=01;35:*.aiff=00;32:*.ape=00;32:*.au=00;32:*.flac=00;32:*.m4a=00;32:*.mid=00;32:*.mp3=00;32:*.mpc=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:*.wma=00;32:*.wv=00;32:'                                                                                                 
#     HOSTTYPE = 'x86_64'
#     XAUTHLOCALHOSTNAME = 'linux-eu06'
#     LESSCLOSE = 'lessclose.sh %s %s'
#     XKEYSYMDB = '/usr/X11R6/lib/X11/XKeysymDB'
#     LANG = 'pt_PT.UTF-8'
#     WINDOWMANAGER = '/usr/bin/startkde'
#     LESS = '-M -I -R'
#     PROFILEHOME = ''
#     DISPLAY = ':0'
#     JAVA_ROOT = '/usr/lib64/jvm/java'
#     HOSTNAME = 'linux-eu06'
#     SHELL_SESSION_ID = '789fbea46fec4654aed5fff424f3a209'
#     CONFIG_SITE = '/usr/share/site/x86_64-unknown-linux-gnu'
#     CSHEDIT = 'emacs'
#     GPG_TTY = '/dev/pts/0'
#     AUDIODRIVER = 'pulseaudio'
#     LESS_ADVANCED_PREPROCESSOR = 'no'
#     COLORTERM = 'truecolor'
#     JAVA_HOME = '/usr/lib64/jvm/java'
#     ALSA_CONFIG_PATH = '/etc/alsa-pulse.conf'
#     MACHTYPE = 'x86_64-suse-linux'
#     XDG_VTNR = '7'
#     QEMU_AUDIO_DRV = 'pa'
#     MINICOM = '-c on'
#     QT_SYSTEM_DIR = '/usr/share/desktop-data'
#     OSTYPE = 'linux'
#     XDG_SESSION_ID = '1'
#     USER = 'leonardo'
#     PAGER = 'less'
#     DESKTOP_SESSION = '/usr/share/xsessions/default'
#     KONSOLE_VERSION = '181203'
#     GTK2_RC_FILES = '/etc/gtk-2.0/gtkrc:/home/leonardo/.gtkrc-2.0:/home/leonardo/.config/gtkrc-2.0'
#     MORE = '-sl'
#     PWD = '//home/leonardo/program'
#     SSH_ASKPASS = '/usr/lib/ssh/ssh-askpass'
#     HOME = '/home/leonardo'
#     HOST = 'linux-eu06'
#     XNLSPATH = '/usr/share/X11/nls'
#     XDG_SESSION_TYPE = 'x11'
#     SDK_HOME = '/usr/lib64/jvm/java'
#     XDG_DATA_DIRS = '/home/leonardo/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share'
#     KONSOLE_DBUS_SESSION = '/Sessions/1'
#     JDK_HOME = '/usr/lib64/jvm/java'
#     XDG_SESSION_DESKTOP = 'KDE'
#     PROFILEREAD = 'true'
#     KONSOLE_DBUS_WINDOW = '/Windows/1'
#     GTK_MODULES = 'canberra-gtk-module'
#     FROM_HEADER = ''
#     MAIL = '/var/spool/mail/leonardo'
#     LESSKEY = '/etc/lesskey.bin'
#     TERM = 'xterm-256color'
#     SHELL = '/bin/bash'
#     KONSOLE_DBUS_SERVICE = ':1.35'
#     XDG_SESSION_CLASS = 'user'
#     XDG_SEAT_PATH = '/org/freedesktop/DisplayManager/Seat0'
#     QT_IM_MODULE = 'xim'
#     XMODIFIERS = '@im=local'
#     LS_OPTIONS = '-N --color=tty -T 0'
#     XCURSOR_THEME = 'breeze_cursors'
#     XDG_CURRENT_DESKTOP = 'KDE'
#     KONSOLE_PROFILE_NAME = 'Predefinição'
#     XDG_SEAT = 'seat0'
#     SHLVL = '2'
#     COLORFGBG = '15;0'
#     LANGUAGE = ''
#     G_FILENAME_ENCODING = '@locale,UTF-8,ISO-8859-15,CP1252'
#     MANPATH = '/usr/local/man:/usr/share/man'
#     GTK_RC_FILES = '/etc/gtk/gtkrc:/home/leonardo/.gtkrc:/home/leonardo/.config/gtkrc'
#     WINDOWID = '56623110'
#     XSESSION_IS_UP = 'yes'
#     LOGNAME = 'leonardo'
#     DBUS_SESSION_BUS_ADDRESS = 'unix:path=/run/user/1000/bus'
#     XDG_RUNTIME_DIR = '/run/user/1000'
#     XAUTHORITY = '/home/leonardo/.Xauthority'
#     JRE_HOME = '/usr/lib64/jvm/java/jre'
#     XDG_SESSION_PATH = '/org/freedesktop/DisplayManager/Session0'
#     QT_AUTO_SCREEN_SCALE_FACTOR = '0'
#     XDG_CONFIG_DIRS = '/etc/xdg'
#     PATH = '/home/leonardo/.buildozer/android/platform/apache-ant-1.9.4/bin:/home/leonardo/bin:/usr/local/bin:/usr/bin:/bin'
#     JAVA_BINDIR = '/usr/lib64/jvm/java/bin'
#     KDE_SESSION_UID = '1000'
#     SDL_AUDIODRIVER = 'pulse'
#     KDE_SESSION_VERSION = '5'
#     QT_IM_SWITCHER = 'imsw-multi'
#     G_BROKEN_FILENAMES = '1'
#     HISTSIZE = '1000'
#     SESSION_MANAGER = 'local/linux-eu06:@/tmp/.ICE-unix/1823,unix/linux-eu06:/tmp/.ICE-unix/1823'
#     CPU = 'x86_64'
#     CVS_RSH = 'ssh'
#     LESSOPEN = 'lessopen.sh %s'
#     GTK_IM_MODULE = 'cedilla'
#     OLDPWD = '/home/leonardo'
#     _ = '/usr/bin/buildozer'
#     PACKAGES_PATH = '/home/leonardo/.buildozer/android/packages'
#     ANDROIDSDK = '/home/leonardo/.buildozer/android/platform/android-sdk'
#     ANDROIDNDK = '/home/leonardo/.buildozer/android/platform/android-ndk-r19b'
#     ANDROIDAPI = '27'
#     ANDROIDMINAPI = '21'
# 
# 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
leonardo@linux-eu06://home/leonardo/program> 

更新

@inclement 提示后,第一种情况已经解决,但还是显示问题。我只会放最后一部分,我认为问题出在哪里。什么是 STDERR 和 STDOUT?

[INFO]:    -> directory context /home/leonardo/program/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/setuptools-python3/armeabi-v7a__ndk_target_21/setuptools                                                                                                                                                            
[INFO]:    -> running python3 setup.py install -O2 --root=/home/leonardo/program/.buildozer/android/platform/build-armeabi-v7a/build/pytho...(and 32 more)
Exception in thread background thread for pid 7551:                                                                                                                  
Traceback (most recent call last):
  File "/usr/lib64/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib64/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.6/site-packages/sh.py", line 1540, in wrap
    fn(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/sh.py", line 2459, in background_thread
    handle_exit_code(exit_code)
  File "/usr/lib/python3.6/site-packages/sh.py", line 2157, in fn
    return self.command.handle_command_exit_code(exit_code)
  File "/usr/lib/python3.6/site-packages/sh.py", line 815, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /home/leonardo/program/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/hostpython3/desktop/hostpython3/native-build/python3 setup.py install -O2 --root=/home/leonardo/program/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/myapp --install-lib=.

  STDOUT:
Traceback (most recent call last):
  File "setup.py", line 11, in <module>
    import setuptools
  File "/home/leonardo/program/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/setuptools-python3/armeabi-v7a__ndk_target_21/setuptools/setuptools/__init__.py", line 20, in <module>
    from setuptools.dist import Distribution, Feature
  File "/home/leonardo/program/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/setuptools-python3/armeabi-v7a__ndk_target_21/setuptools/setuptools/dist.py", line 36, in <module>
    from setuptools import windows_support
  File "/home/leonardo/program/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/setuptools-python3/armeabi-v7a__ndk_target_21/setuptools/setuptools/windows_support.py", line 2, in <module>
    import ctypes
  File "/home/leonardo/program/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/hostpython3/desktop/hostpython3/Lib/ctypes/__init__.py", line 7, in <module>
    from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'


  STDERR:


Traceback (most recent call last):
  File "/usr/lib64/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/leonardo/program/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1196, in <module>
    main()
  File "/home/leonardo/program/.buildozer/android/platform/python-for-android/pythonforandroid/entrypoints.py", line 18, in main
    ToolchainCL()
  File "/home/leonardo/program/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 671, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/home/leonardo/program/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 155, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/home/leonardo/program/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 209, in build_dist_from_args
    args, "ignore_setup_py", False
  File "/home/leonardo/program/.buildozer/android/platform/python-for-android/pythonforandroid/build.py", line 580, in build_recipes
    recipe.build_arch(arch)
  File "/home/leonardo/program/.buildozer/android/platform/python-for-android/pythonforandroid/recipe.py", line 960, in build_arch
    self.install_python_package(arch)
  File "/home/leonardo/program/.buildozer/android/platform/python-for-android/pythonforandroid/recipe.py", line 979, in install_python_package
    _env=hpenv, *self.setup_extra_args)
  File "/home/leonardo/program/.buildozer/android/platform/python-for-android/pythonforandroid/logger.py", line 180, in shprint
    for line in output:
  File "/usr/lib/python3.6/site-packages/sh.py", line 863, in next
    self.wait()
  File "/usr/lib/python3.6/site-packages/sh.py", line 792, in wait
    self.handle_command_exit_code(exit_code)
  File "/usr/lib/python3.6/site-packages/sh.py", line 815, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /home/leonardo/program/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/hostpython3/desktop/hostpython3/native-build/python3 setup.py install -O2 --root=/home/leonardo/program/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/myapp --install-lib=.

  STDOUT:
Traceback (most recent call last):
  File "setup.py", line 11, in <module>
    import setuptools
  File "/home/leonardo/program/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/setuptools-python3/armeabi-v7a__ndk_target_21/setuptools/setuptools/__init__.py", line 20, in <module>
    from setuptools.dist import Distribution, Feature
  File "/home/leonardo/program/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/setuptools-python3/armeabi-v7a__ndk_target_21/setuptools/setuptools/dist.py", line 36, in <module>
    from setuptools import windows_support
  File "/home/leonardo/program/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/setuptools-python3/armeabi-v7a__ndk_target_21/setuptools/setuptools/windows_support.py", line 2, in <module>
    import ctypes
  File "/home/leonardo/program/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/hostpython3/desktop/hostpython3/Lib/ctypes/__init__.py", line 7, in <module>
    from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'


  STDERR:

# Command failed: /usr/bin/python3 -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=python3,kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir="/home/leonardo/program/.buildozer/android/platform/build-armeabi-v7a" --ndk-api=21                                                      
# ENVIRONMENT:
#     GS_LIB = '/home/leonardo/.fonts'
#     KDE_FULL_SESSION = 'true'
#     LS_COLORS = 'no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.xz=00;31:*.avi=01;35:*.bmp=01;35:*.dl=01;35:*.fli=01;35:*.gif=01;35:*.gl=01;35:*.jpg=01;35:*.jpeg=01;35:*.mkv=01;35:*.mng=01;35:*.mov=01;35:*.mp4=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.svg=01;35:*.tga=01;35:*.tif=01;35:*.webm=01;35:*.webp=01;35:*.wmv=01;35:*.xbm=01;35:*.xcf=01;35:*.xpm=01;35:*.aiff=00;32:*.ape=00;32:*.au=00;32:*.flac=00;32:*.m4a=00;32:*.mid=00;32:*.mp3=00;32:*.mpc=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:*.wma=00;32:*.wv=00;32:'                                                                                                 
#     HOSTTYPE = 'x86_64'
#     XAUTHLOCALHOSTNAME = 'linux-eu06'
#     LESSCLOSE = 'lessclose.sh %s %s'
#     XKEYSYMDB = '/usr/X11R6/lib/X11/XKeysymDB'
#     LANG = 'pt_PT.UTF-8'
#     WINDOWMANAGER = '/usr/bin/startkde'
#     LESS = '-M -I -R'
#     PROFILEHOME = ''
#     DISPLAY = ':0'
#     JAVA_ROOT = '/usr/lib64/jvm/java'
#     HOSTNAME = 'linux-eu06'
#     SHELL_SESSION_ID = 'cdd70e16c2b5470da27c38607a43356e'
#     CONFIG_SITE = '/usr/share/site/x86_64-unknown-linux-gnu'
#     CSHEDIT = 'emacs'
#     GPG_TTY = '/dev/pts/0'
#     AUDIODRIVER = 'pulseaudio'
#     LESS_ADVANCED_PREPROCESSOR = 'no'
#     COLORTERM = 'truecolor'
#     JAVA_HOME = '/usr/lib64/jvm/java'
#     ALSA_CONFIG_PATH = '/etc/alsa-pulse.conf'
#     MACHTYPE = 'x86_64-suse-linux'
#     XDG_VTNR = '7'
#     QEMU_AUDIO_DRV = 'pa'
#     MINICOM = '-c on'
#     QT_SYSTEM_DIR = '/usr/share/desktop-data'
#     OSTYPE = 'linux'
#     XDG_SESSION_ID = '1'
#     USER = 'leonardo'
#     PAGER = 'less'
#     DESKTOP_SESSION = '/usr/share/xsessions/default'
#     KONSOLE_VERSION = '181203'
#     GTK2_RC_FILES = '/etc/gtk-2.0/gtkrc:/home/leonardo/.gtkrc-2.0:/home/leonardo/.config/gtkrc-2.0'
#     MORE = '-sl'
#     PWD = '//home/leonardo/program'
#     SSH_ASKPASS = '/usr/lib/ssh/ssh-askpass'
#     HOME = '/home/leonardo'
#     HOST = 'linux-eu06'
#     XNLSPATH = '/usr/share/X11/nls'
#     XDG_SESSION_TYPE = 'x11'
#     SDK_HOME = '/usr/lib64/jvm/java'
#     XDG_DATA_DIRS = '/home/leonardo/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share'
#     KONSOLE_DBUS_SESSION = '/Sessions/1'
#     JDK_HOME = '/usr/lib64/jvm/java'
#     XDG_SESSION_DESKTOP = 'KDE'
#     PROFILEREAD = 'true'
#     KONSOLE_DBUS_WINDOW = '/Windows/1'
#     GTK_MODULES = 'canberra-gtk-module'
#     FROM_HEADER = ''
#     MAIL = '/var/spool/mail/leonardo'
#     LESSKEY = '/etc/lesskey.bin'
#     TERM = 'xterm-256color'
#     SHELL = '/bin/bash'
#     KONSOLE_DBUS_SERVICE = ':1.34'
#     XDG_SESSION_CLASS = 'user'
#     XDG_SEAT_PATH = '/org/freedesktop/DisplayManager/Seat0'
#     QT_IM_MODULE = 'xim'
#     XMODIFIERS = '@im=local'
#     LS_OPTIONS = '-N --color=tty -T 0'
#     XCURSOR_THEME = 'breeze_cursors'
#     XDG_CURRENT_DESKTOP = 'KDE'
#     KONSOLE_PROFILE_NAME = 'Predefinição'
#     XDG_SEAT = 'seat0'
#     SHLVL = '2'
#     COLORFGBG = '15;0'
#     LANGUAGE = ''
#     G_FILENAME_ENCODING = '@locale,UTF-8,ISO-8859-15,CP1252'
#     MANPATH = '/usr/local/man:/usr/share/man'
#     GTK_RC_FILES = '/etc/gtk/gtkrc:/home/leonardo/.gtkrc:/home/leonardo/.config/gtkrc'
#     WINDOWID = '54525958'
#     XSESSION_IS_UP = 'yes'
#     LOGNAME = 'leonardo'
#     DBUS_SESSION_BUS_ADDRESS = 'unix:path=/run/user/1000/bus'
#     XDG_RUNTIME_DIR = '/run/user/1000'
#     XAUTHORITY = '/home/leonardo/.Xauthority'
#     JRE_HOME = '/usr/lib64/jvm/java/jre'
#     XDG_SESSION_PATH = '/org/freedesktop/DisplayManager/Session0'
#     QT_AUTO_SCREEN_SCALE_FACTOR = '0'
#     XDG_CONFIG_DIRS = '/etc/xdg'
#     PATH = '/home/leonardo/.buildozer/android/platform/apache-ant-1.9.4/bin:/home/leonardo/bin:/usr/local/bin:/usr/bin:/bin'
#     JAVA_BINDIR = '/usr/lib64/jvm/java/bin'
#     KDE_SESSION_UID = '1000'
#     SDL_AUDIODRIVER = 'pulse'
#     KDE_SESSION_VERSION = '5'
#     QT_IM_SWITCHER = 'imsw-multi'
#     G_BROKEN_FILENAMES = '1'
#     HISTSIZE = '1000'
#     SESSION_MANAGER = 'local/linux-eu06:@/tmp/.ICE-unix/1836,unix/linux-eu06:/tmp/.ICE-unix/1836'
#     CPU = 'x86_64'
#     CVS_RSH = 'ssh'
#     LESSOPEN = 'lessopen.sh %s'
#     GTK_IM_MODULE = 'cedilla'
#     OLDPWD = '/home/leonardo'
#     _ = '/usr/bin/buildozer'
#     PACKAGES_PATH = '/home/leonardo/.buildozer/android/packages'
#     ANDROIDSDK = '/home/leonardo/.buildozer/android/platform/android-sdk'
#     ANDROIDNDK = '/home/leonardo/.buildozer/android/platform/android-ndk-r19b'
#     ANDROIDAPI = '27'
#     ANDROIDMINAPI = '21'
# 
# 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
leonardo@linux-eu06://home/leonardo/program> 

【问题讨论】:

【参考方案1】:

您必须看到错误,因此您必须安装缺少的任何内容。然后再次运行该命令。我在生成apk文件时也遇到了很多问题,经过4-5个小时的连续调试,我终于成功了。

第一个错误:

检查配置令牌 sdkmanager 路径 “/home/subhasish/.buildozer/android/platform/android-sdk/tools/bin/sdkmanager” 不存在,sdkmanager 没有安装。

解决方案: 我创建了新文件夹: /home/subhasish/DevTools/Android/cmdline-tools

curl -L -O -C - https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip

解压上面的文件并复制上面制作的文件夹下的内容。

打开您的buildozer.spec 文件并修改

android.sdk_path = /home/subhasish/DevTools/Android/cmdline-tools/

上述错误已解决。现在 # buildozer android debug 给出以下错误:

.buildozer/android/platform/build-armeabi-v7a/build/other_builds/libffi/armeabi-v7a__ndk_target_21/libffi/autogen.sh: 2:执行:autoreconf:未找到

然后我安装了:

sudo apt-get install automake
sudo apt-get install autoconf  
sudo apt-get install libltdl-dev

再次陷入错误:

引发 CommandNotFound(k) sh.CommandNotFound: zip

sudo apt-get install zip

最后创建了 apk,并在移动设备上进行了测试。它的工作。

以上输入可能对某人有所帮助。

【讨论】:

【参考方案2】:

您似乎缺少patch 命令。尝试安装它。我不知道 opensuse 上的包名是什么,但应该很明显。

【讨论】:

你是对的。我不得不安装补丁。我通过 Yast2 安装。谢谢。尽管如此,它仍然存在错误。如果有人知道,请帮助我。我将编辑,添加当前情况。

以上是关于我无法通过 buildozer 生成 APK的主要内容,如果未能解决你的问题,请参考以下文章

Buildozer 无法编译 .apk,因为未定义“xrange”

使用 buildozer 创建 kivy apk 错误:“Aidl 无法执行”

无法在 Google Colab 中使用 buildozer 构建我的应用 apk?

Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m "kivy" d

为啥 Kivy apk 在 android 设备上启动 apk 后立即崩溃

在 Ubuntu 12.04 上使用 Kivy 和 Buildozer 制作 apk