当我用buildozer编译为apk时。但是发生了错误
# Check configuration tokens
# Ensure build layout
# Check configuration tokens
# Preparing build
# Check requirements for android
# Run 'dpkg --version'
# Cwd None
Debian 'dpkg' package management program version 1.18.4 (amd64).
This is free software; see the GNU General Public License version 2 or
later for copying conditions. There is NO warranty.
# Search for Git (git)
# -> found at /usr/bin/git
# Search for Cython (cython)
# -> found at /usr/local/bin/cython
# Search for Java compiler (javac)
# -> found at /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
# Search for Java keytool (keytool)
# -> found at /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/keytool
# Install platform
# Run 'git config --get remote.origin.url'
# Cwd /mnt/d/project1/test/.buildozer/android/platform/python-for-android
https://github.com/kivy/python-for-android.git
# Run 'git branch -vv'
# Cwd /mnt/d/project1/test/.buildozer/android/platform/python-for-android
* master dd69749 [origin/master] Merge pull request #1955 from kivy/release-2019.08.09
# 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\' \'pytoml\' \'virtualenv\''
# Cwd None
WARNING: The directory '/home/huy/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
WARNING: The directory '/home/huy/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
# Apache ANT found at /home/huy/.buildozer/android/platform/apache-ant-1.9.4
# Android SDK found at /mnt/d/project1/test
# Android NDK found at /mnt/d/project1/test
# Recommended android's NDK version by p4a is: 17c
# Check application requirements
# Check garden requirements
# Compile platform
# Run '/usr/bin/python3 -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=python3,kivy,opencv,webcolors,numpy --arch x86 --copy-libs --color=always --storage-dir="/mnt/d/project1/test/.buildozer/android/platform/build-x86" --ndk-api=21'
# Cwd /mnt/d/project1/test/.buildozer/android/platform/python-for-android
[INFO]: Will compile for the following archs: x86
[INFO]: Found Android API target in $ANDROIDAPI: 27
[INFO]: Available Android APIs are (15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29)
[INFO]: Requested API target 27 is available, continuing.
[INFO]: Found NDK dir in $ANDROIDNDK: /mnt/d/project1/test
[INFO]: Could not determine NDK version, no source.properties in the NDK dir
[WARNING]: Unable to read the NDK version from the given directory /mnt/d/project1/test
[WARNING]: Make sure your NDK version is greater than 17. If you get build errors, download the recommended NDK 17c from https://developer.android.com/ndk/downloads/
[INFO]: Getting NDK API version (i.e. minimum supported API) from user argument
[INFO]: Found virtualenv at /usr/local/bin/virtualenv
[INFO]: ccache is missing, the build will not be optimized in the future.
[WARNING]: ndk_platform doesn't exist: /mnt/d/project1/test/platforms/android-21/arch-x86
[WARNING]: Could not find toolchain subdirectory!
[WARNING]: Could not find any toolchain for x86!
Traceback (most recent call last):
File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/mnt/d/project1/test/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1192, in <module>
main()
File "/mnt/d/project1/test/.buildozer/android/platform/python-for-android/pythonforandroid/entrypoints.py", line 18, in main
ToolchainCL()
File "/mnt/d/project1/test/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 668, in __init__
getattr(self, args.subparser_name.replace('-', '_'))(args)
File "/mnt/d/project1/test/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 146, in wrapper_func
user_ndk_api=self.ndk_api)
File "/mnt/d/project1/test/.buildozer/android/platform/python-for-android/pythonforandroid/build.py", line 410, in prepare_build_environment
self.toolchain_version = toolchain_version
UnboundLocalError: local variable 'toolchain_version' referenced before assignment
# Command failed: /usr/bin/python3 -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=python3,kivy,opencv,webcolors,numpy --arch x86 --copy-libs --color=always --storage-dir="/mnt/d/project1/test/.buildozer/android/platform/build-x86" --ndk-api=21
# ENVIRONMENT:
# LOGNAME = 'huy'
# PWD = '/mnt/d/project1/test'
# OLDPWD = '/home/huy'
# NAME = 'LAPTOP-ITVNMQ83'
# USER = 'huy'
# LANG = 'en_US.UTF-8'
# SHELL = '/bin/bash'
# TERM = 'xterm-256color'
# ANDROIDNDK = '/mnt/d/project1/test'
# PACKAGES_PATH = '/home/huy/.buildozer/android/packages'
# ANDROIDSDK = '/mnt/d/project1/test'
# SHLVL = '1'
# WSLENV = ''
# HOSTTYPE = 'x86_64'
# XDG_DATA_DIRS = '/usr/local/share:/usr/share:/var/lib/snapd/desktop'
# LESSCLOSE = '/usr/bin/lesspipe %s %s'
# ANDROIDMINAPI = '21'
# LS_COLORS = 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:'
# ANDROIDAPI = '27'
# _ = '/usr/local/bin/buildozer'
# LESSOPEN = '| /usr/bin/lesspipe %s'
# PATH = ('/home/huy/.buildozer/android/platform/apache-ant-1.9.4/bin:/home/huy/bin:/home/huy/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program '
'Files/WindowsApps/CanonicalGroupLimited.Ubuntu16.04onWindows_1604.2019.523.0_x64__79rhkp1fndgsc:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Windows/System32/OpenSSH:/mnt/c/Program '
'Files (x86)/NVIDIA '
'Corporation/PhysX/Common:/mnt/c/FPC/3.0.4/bin/i386-win32:/mnt/c/Program '
'Files (x86)/VietPN:/mnt/c/Users/LAPTOP '
'ASUS/AppData/Local/Microsoft/WindowsApps:/snap/bin')
# HOME = '/home/huy'
#
# 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
所以这是完整的日志,我什至不知道如何解决,甚至检查.spec文件,但没有任何效果 我在buildozer中使用kivy。我安装了所有。 我什至不知道什么是未绑定错误。我已竭尽所能修复它。但是什么也没发生。 请告诉我该怎么办?? 救命!! 非常感谢。
答案 0 :(得分:0)
下载最新的NDK。确保 buildozer.spec 中的初始化适合您的环境。
# (str) Android NDK directory (if empty, it will be automatically downloaded.)
android.ndk_path =/home/bembite/Downloads/android-ndk-r21d
# (int) Target Android API, should be as high as possible.
android.api = 27
# (int) Minimum API your APK will support.
android.minapi = 21
# (int) Android SDK version to use
android.sdk = 20
# (str) Android NDK version to use
android.ndk = 19b
python-for-android存储库中描述了许多有关配置环境的问题。
最后一次向您推荐huy(哈哈)正在使用配置好的工具链下载docker image。