Buildozer (python-for-android) 关于 python2 的错误消息

Buildozer (python-for-android) error message about python2

尝试在 Ubuntu 18.04 VM 上使用 buildozer 0.39 编译 apk。 我收到一个奇怪的错误:

# Run '/usr/bin/python -m pythonforandroid.toolchain create --dist_name=XXXXXX --bootstrap=sdl2 --requirements=python2,kivy,sqlite3,requests,feedparser,html2bbcode --arch armeabi-v7a --copy-libs --color=always --storage-dir="/home/kivy/4Build/XXXXXX/.buildozer/android/platform/build" --ndk-api=21'
# Cwd /home/kivy/4Build/XXXXXX/.buildozer/android/platform/python-for-android
[ERROR]:   Build failed: python-for-android no longer supports running under Python 2. Either upgrade to Python 3.4 or higher (recommended), or revert to python-for-android 2019.07.08. Note that you *can* still target Python 2 on Android by including python2 in your requirements.

我使用的命令包括 python2 要求,但 python-for-android 说它不...

我今天刚遇到同样的问题。几天前我没有这个问题。幸运的是,我对过去有用的文件夹进行了多次备份。我的解决方案是从其中一个备份 (yourfoldername)/.buildozer/android/platform 的路径复制文件夹 python-for-android 并将其粘贴到新文件夹/.buildozer/android/platform。然后 运行 buildozer -v android debug deploy 运行。一切都恢复正常了。

正如上面 Mr.inclement 评论的那样,我需要卸载 buildozer 并使用 python3 安装。除了删除 buildozer 文件夹之外,我不确定如何卸载 buildozer。然后如何使用pyhon3安装?指令是git clone https://github.com/kivy/buildozer.git, cd buildozer, sudo python setup.py install。所以在最后一步,我需要使用 sudo python3 setup.py install 吗?我不想弄乱已经在工作的东西。所以我使用我的一个备份中的 python-for-android 文件夹。

好吧,将项目转换为 Python 3 并使用更新的 VM (that I found here) 编译它成功了!
仍然没有办法用 Python 2 做到这一点..