为 Android 编译时出现 Buildozer 错误:列表索引超出范围

Buildozer error when compiling for Android: list index out of range

我目前正在尝试编译一个相当简单的 Kivy 应用程序以供 Android 使用。应用程序 运行 在桌面上按预期运行,没有错误或警告(linux 和 windows),但是在编译过程中我 运行 进入标题中给出的错误。以下是编译期间显示的所有内容的完整副本:

buildozer android debug deploy run
# Check configuration tokens
# Ensure build layout
# Check configuration tokens
# Preparing build
# Check requirements for android
# Install platform
# Apache ANT found at /home/freakjoe/.buildozer/android/platform/apache-ant-1.9.4
# Android SDK found at /home/freakjoe/.buildozer/android/platform/android-sdk-20
# Android NDK found at /home/freakjoe/.buildozer/android/platform/android-ndk-r9c
# Check application requirements
# Check garden requirements
# Compile platform
# Distribution already compiled, pass.
# Build the application #21
# Package the application
Traceback (most recent call last):
  File "/usr/local/bin/buildozer", line 9, in <module>
    load_entry_point('buildozer==0.33.dev0', 'console_scripts', 'buildozer')()
  File "/usr/local/lib/python2.7/dist-packages/buildozer-0.33.dev0-py2.7.egg/buildozer/scripts/client.py", line 13, in main
    Buildozer().run_command(sys.argv[1:])
  File "/usr/local/lib/python2.7/dist-packages/buildozer-0.33.dev0-py2.7.egg/buildozer/__init__.py", line 1020, in run_command
    self.target.run_commands(args)
  File "/usr/local/lib/python2.7/dist-packages/buildozer-0.33.dev0-py2.7.egg/buildozer/target.py", line 91, in run_commands
    func(args)
  File "/usr/local/lib/python2.7/dist-packages/buildozer-0.33.dev0-py2.7.egg/buildozer/target.py", line 103, in cmd_debug
    self.buildozer.build()
  File "/usr/local/lib/python2.7/dist-packages/buildozer-0.33.dev0-py2.7.egg/buildozer/__init__.py", line 211, in build
    self.target.build_package()
  File "/usr/local/lib/python2.7/dist-packages/buildozer-0.33.dev0-py2.7.egg/buildozer/targets/android.py", line 645, in build_package
    self._update_libraries_references(dist_dir)
  File "/usr/local/lib/python2.7/dist-packages/buildozer-0.33.dev0-py2.7.egg/buildozer/targets/android.py", line 839, in _update_libraries_references
    if not content[-1].endswith(u'\n'):
IndexError: list index out of range

我没有对 运行ning buildozer init 创建的 .spec 文件进行任何更改。我正在使用 Python 2.7 和 运行ning Linux Mint。

如有任何帮助,我们将不胜感激!

根据 this Google 论坛帖子,您的错误已修复,您应该尝试更新您的 Buildozer 安装。

Mathieu Virbel:

I recently fixed something about that, try master. If it doesn't work, open an issue. If content[-1 doesn't work, it may mean that the reference is empty, and so there is another issue somewhere before it. Sending us the whole log may help.

我有同样的错误运行:

buildozer android debug

我认为在编译过程中按 Ctrl+c 后出现错误命令停止它。之后错误继续。

buildozer version == 0.35
python 3.6.6
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux

为了解决这个错误,我尝试使用:

$ buildozer dist-clean
$ buildozer android clean

但错误依然存在。

所以我推荐你使用buildozer 0.34

sudo -H pip3 install buildozer==0.34

如果您正在使用 python 2.7.x:

sudo -H pip install buildozer==0.34