Kivy: Buildozer.spec 文件未完成

Kivy: Buildozer.spec file is not completed

我准备了kivy buildozer以供使用。对于安装,我使用了说明 here,过程 python 3。在第 3 步之后,buildozer.spec 文件未完成并检查了行(第 4 步) 有下一个内容:

requirements = kivy
#android.ndk_path = 

关于在 buildozer android debug deploy 运行:

之后安装的消息
# Unpacking Android NDK
# Android NDK installation done.
# Check application requirements
# Check garden requirements
# Compile platform
# Command failed: /usr/bin/python -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir=/media/sf_ForBuildozer/.buildozer/android/platform/build
# 
# Buildozer failed to execute the last command
# If the error is not obvious, please raise the log_level to 2
# and retry the latest command.
# In case of a bug report, please add a full log with log_level = 2

问题的根源是什么?

我在 buildozer 部分添加了 log_level = 2,新消息:

# Run '/usr/bin/python -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir=/media/sf_ForBuildozer/.buildozer/android/platform/build'
# Cwd /media/sf_ForBuildozer/.buildozer/android/platform/python-for-android-new-toolchain
[INFO]:    Will compile for the following archs: armeabi-v7a
[INFO]:    Found Android API target in $ANDROIDAPI
[INFO]:    Available Android APIs are ()
[WARNING]: Requested API target 19 is not available, install it with the SDK android tool.
[WARNING]: Exiting.
# Command failed: /usr/bin/python -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir=/media/sf_ForBuildozer/.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

我应用了 Mikhail Gerasimov 的建议,经过一小步后我收到了新消息:

# Run '/usr/bin/python -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir=/media/sf_ForBuildozer/.buildozer/android/platform/build'
# Cwd /media/sf_ForBuildozer/.buildozer/android/platform/python-for-android-new-toolchain
[INFO]:    Will compile for the following archs: armeabi-v7a
[INFO]:    Found Android API target in $ANDROIDAPI
[INFO]:    Available Android APIs are ()
[WARNING]: Requested API target 19 is not available, install it with the SDK android tool.
[WARNING]: Exiting.
# Command failed: /usr/bin/python -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir=/media/sf_ForBuildozer/.buildozer/android/platform/build

这里的问题是 SDK 不包含为目标 API 构建的所有内容。通常 buildozer 会自动处理它,但有时 it breaks。您可以通过 GUI 手动安装东西(参见上面的 link),或者像我通常通过 (linux) 控制台那样安装:

echo y | android-sdk-linux/tools/android update sdk --all --no-ui --filter tools
echo y | android-sdk-linux/tools/android update sdk --all --no-ui --filter platform-tools
echo y | android-sdk-linux/tools/android update sdk --all --no-ui --filter build-tools-27.0.2
echo y | android-sdk-linux/tools/android update sdk --all --no-ui --filter android-19

确保您的 SDK 目录在 android-sdk-linux/tools/android 可用。 安装所有这些后,我认为错误应该消失了。