【问题标题】:Can't build Kivy project with buildozer and python3crystax无法使用 buildozer 和 python3crystax 构建 Kivy 项目
【发布时间】:2018-05-14 18:59:11
【问题描述】:

抱歉,可能是愚蠢的问题,但今天我花了大约 5 个小时尝试使用 Python3、Buildozer 和 Crystax NDK 构建简单的 apk。我使用了 Buildozer VM,下载了 Crystax ndk 10.3.2,按照 github 指令 https://github.com/kivy/buildozer 创建了 buildozer.spec。我的 buildozer.spec:

title = Cyba app
package.name = cyapp
package.domain = ru.longint
source.dir = .
requirements = python3crystax,kivy
android.ndk_path = ~/.buildozer/crystax-ndk

还有其他几个。 当我运行buildozer -v android debug 进行第一次编译时(根据 Buildozer wiki 上的说明),我得到了下一个日志:

# 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.10 (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
# Apache ANT found at /home/kivy/.buildozer/android/platform/apache-ant-1.9.4
# Android SDK found at /home/kivy/.buildozer/android/platform/android-sdk-20
# Android NDK found at /home/kivy/.buildozer/crystax-ndk
# Check application requirements
# Run './distribute.sh -l'
# Cwd /home/kivy/Documents/kbs/.buildozer/android/platform/python-for-android
Available modules: android apsw audiostream bidi boost cherrypy c_igraph click cprotobuf cymunk django docutils ecdsa enum34 evdev ffmpeg ffmpeg2 ffpyplayer ffpyplayer_tito flask freetype gevent greenlet harfbuzz hostpython igraph itsdangerous jinja2 jpeg kivent_core kivent_cymunk kivy leveldb libevent libpq libsodium libswift libtorrent libxml2 libxslt libyaml lxml m2crypto markupsafe midistream msgpack mysql_connector netifaces numpy opencv openssl paramiko pil plyer plyvel png polygon protobuf psutil psycopg2 pyasn1 pycrypto pygame pyjnius pylibpd pyopenssl pyparsing pyqrcode python pyyaml sdl setuptools six sqlalchemy sqlite3 storm swift thrift twisted txws werkzeug wokkel zeroconf zope
# Remove directory and subdirectory /home/kivy/Documents/kbs/.buildozer/applibs
# Create directory /home/kivy/Documents/kbs/.buildozer/applibs
# Run 'bash -c "source venv/bin/activate && env"'
# Cwd /home/kivy/Documents/kbs/.buildozer
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:*.zst=01;31:*.tzst=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:*.mjpg=01;35:*.mjpeg=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:
LESSCLOSE=/usr/bin/lesspipe %s %s
XDG_MENU_PREFIX=xfce-
LANG=en_US.UTF-8
GDM_LANG=en_US
DISPLAY=:0.0
ANDROIDAPI=19
GTK_OVERLAY_SCROLLING=0
COLORTERM=truecolor
XDG_VTNR=7
SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
VIRTUAL_ENV=/home/kivy/Documents/kbs/.buildozer/venv
MANDATORY_PATH=/usr/share/gconf/xubuntu.mandatory.path
GLADE_CATALOG_PATH=:
XDG_SESSION_ID=c2
XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/kivy
USER=kivy
GLADE_MODULE_PATH=:
DESKTOP_SESSION=xubuntu
ANDROIDNDK=/home/kivy/.buildozer/crystax-ndk
DEFAULTS_PATH=/usr/share/gconf/xubuntu.default.path
QT_QPA_PLATFORMTHEME=gtk2
PWD=/home/kivy/Documents/kbs/.buildozer
HOME=/home/kivy
ANDROIDSDK=/home/kivy/.buildozer/android/platform/android-sdk-20
SSH_AGENT_PID=1309
QT_ACCESSIBILITY=1
XDG_SESSION_TYPE=x11
XDG_DATA_DIRS=/usr/share/xubuntu:/usr/share/xfce4:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop:/usr/share
PACKAGES_PATH=/home/kivy/.buildozer/android/packages
XDG_SESSION_DESKTOP=xubuntu
GLADE_PIXMAP_PATH=:
CLUTTER_BACKEND=x11
VTE_VERSION=4402
SHELL=/bin/bash
TERM=xterm-256color
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
XDG_CURRENT_DESKTOP=XFCE
QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1
SHLVL=2
XDG_SEAT=seat0
LANGUAGE=en_US:
ANDROIDNDKVER=r9c
WINDOWID=67112367
GDMSESSION=xubuntu
LOGNAME=kivy
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
XDG_RUNTIME_DIR=/run/user/1000
XAUTHORITY=/home/kivy/.Xauthority
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
XDG_CONFIG_DIRS=/etc/xdg/xdg-xubuntu:/etc/xdg:/etc/xdg
PATH=/home/kivy/Documents/kbs/.buildozer/venv/bin:/home/kivy/.buildozer/android/platform/apache-ant-1.9.4/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
PS1=(venv) 
SESSION_MANAGER=local/kivyvm:@/tmp/.ICE-unix/1327,unix/kivyvm:/tmp/.ICE-unix/1327
LESSOPEN=| /usr/bin/lesspipe %s
_=/usr/bin/env
# Install distribute
# Run 'curl http://python-distribute.org/distribute_setup.py | venv/bin/python'
# Cwd /home/kivy/Documents/kbs/.buildozer
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:02:10 --:--:--     0curl: (7) Failed to connect to python-distribute.org port 80: Connection timed out
# Install requirement python3crystax in virtualenv
# Run 'pip install --target=/home/kivy/Documents/kbs/.buildozer/applibs python3crystax'
# Cwd /home/kivy/Documents/kbs/.buildozer
Collecting python3crystax
  Could not find a version that satisfies the requirement python3crystax (from versions: )
No matching distribution found for python3crystax
# Command failed: pip install --target=/home/kivy/Documents/kbs/.buildozer/applibs python3crystax
# 
# 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

这是我的问题: 1)什么是python3crystax字面意思?是 pip 包、实用程序、文件还是什么? 2)我必须手动下载python3crystax,我可以在哪里下载? 3)我做错了什么?

更新: 我找到了this 问题并尝试了buildozer -v android_new debug 得到这个(buildozer.spec 中的 log_level 是 2):

# 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.10 (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
# Apache ANT found at /home/kivy/.buildozer/android/platform/apache-ant-1.9.4
# Android SDK found at /home/kivy/.buildozer/android/platform/android-sdk-20
# Android NDK found at /home/kivy/.buildozer/crystax-ndk
# Check application requirements
# Check garden requirements
# Compile platform
# Run 'python -m pythonforandroid.toolchain --color=always --storage-dir=/home/kivy/Documents/kbs/.buildozer/android/platform/build create --dist_name=cyapp --bootstrap=sdl2 --requirements=python3crystax,kivy --arch armeabi-v7a --copy-libs'
# Cwd /home/kivy/Documents/kbs/.buildozer/android/platform/python-for-android-master
[INFO]:    Will compile for the following archs: armeabi-v7a
[INFO]:    Found Android API target in $ANDROIDAPI
[INFO]:    Available Android APIs are (19)
[INFO]:    Requested API target 19 is available, continuing.
[INFO]:    Found NDK dir in $ANDROIDNDK
[INFO]:    Got NDK version from $ANDROIDNDKVER
[WARNING]: NDK version was set as r10.3.2, but checking the NDK dir claims it is 10.3.2.
[WARNING]: The build will try to continue, but it may fail and you should check that your setting is correct.
[WARNING]: If the NDK dir result is correct, you don't need to manually set the NDK ver.
[INFO]:    Using Crystax NDK r10.3.2
[INFO]:    Found virtualenv at /usr/local/bin/virtualenv
[INFO]:    ccache is missing, the build will not be optimized in the future.
[WARNING]: include directory doesn't exist: /home/kivy/.buildozer/crystax-ndk/sysroot/usr/include/arm-linux-androideabi
[INFO]:    Found the following toolchain versions: ['4.9', '5', 'clang3.6', 'clang3.7']
[INFO]:    Picking the latest gcc toolchain, here 5
[WARNING]: Missing executable: autoconf is not installed
[WARNING]: Missing executable: automake is not installed
[WARNING]: Missing executable: libtoolize is not installed
[ERROR]:   python-for-android cannot continue; aborting
# Command failed: python -m pythonforandroid.toolchain --color=always --storage-dir=/home/kivy/Documents/kbs/.buildozer/android/platform/build create --dist_name=cyapp --bootstrap=sdl2 --requirements=python3crystax,kivy --arch armeabi-v7a --copy-libs
# 
# 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

我在日志中看到一些奇怪的字符串。我在 Crystax ndk 文件夹中真的没有这个路径。

[WARNING]: include directory doesn't exist: /home/kivy/.buildozer/crystax-ndk/sysroot/usr/include/arm-linux-androideabi

【问题讨论】:

    标签: android python-3.x kivy buildozer


    【解决方案1】:
    1. 下载并提取Crystax NDK 某处,例如/选择/
    2. 确保以下行在您的 buildozer.spec 文件中。:

      需要python3crystax:

      要求 = python3crystax,kivy

      指向你解压crystax-ndk的目录:

      android.ndk_path = /opt/crystax-ndk-10.3.2

    【讨论】:

    • 我做了这些动作...我的 Crystax ndk 文件夹放在 .buildozer 文件夹 (/home/kivy/.buildozer) 中。还有我的 buildozer.spec : android.ndk_path = ~/.buildozer/crystax-ndk 。我也试过 /home/kivy/.buildozer/crystax-ndk ,同样的错误
    • 编辑你的 buildozer.spec 并替换 log_level = 1' with log_level = 2. Rerun buildozer android_new debug`
    • 忽略警告。请分享最新的调试日志。
    • Log_level = 2,是吗?输出日志没有改变,和我在 UPD 部分发布的一样。
    猜你喜欢
    • 2022-09-23
    • 1970-01-01
    • 2016-12-21
    • 1970-01-01
    • 1970-01-01
    • 2019-12-12
    • 1970-01-01
    • 2014-05-26
    • 1970-01-01
    相关资源
    最近更新 更多