Buildozer-使用buildozer构建APK时出错

时间:2019-03-08 07:00:02

标签: python python-3.x python-2.7 apk buildozer

我尝试使用Kivy的Buildozer VM通过Buildozer制作apk,但出现错误:

Welcome to the Buildozer Virtual Machine.
Please see ~/Desktop/README.txt for more information
kivy@kivy-VirtualBox:~$ cd /home/kivy/Desktop/myapp
kivy@kivy-VirtualBox:~/Desktop/myapp$ buildozer android debug
# Check configuration tokens
# Ensure build layout
# Check configuration tokens
# Read available permissions from api-versions.xml
# Preparing build
# Check requirements for android
# Run 'dpkg --version'
# Cwd None
Debian `dpkg' package management program version 1.17.5 (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-7-openjdk-amd64/bin/javac
# Search for Java keytool (keytool)
#  -> found at /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/keytool
# Install platform
# Run '/usr/bin/python -m pip install -q --user \'appdirs\' \'colorama>=0.3.3\' \'jinja2\' \'six\' \'enum34; python_version<"3.4"\' \'sh>=1.10; sys_platform!="nt"\''
# Cwd None
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 257, in run
    InstallRequirement.from_line(name, None))
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 172, in from_line
    return cls(req, comes_from, url=url, prereleases=prereleases)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 70, in __init__
    req = pkg_resources.Requirement.parse(req)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2667, in parse
    reqs = list(parse_requirements(s))
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2605, in parse_requirements
    line, p, specs = scan_list(VERSION,LINE_END,line,p,(1,2),"version spec")
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2573, in scan_list
    raise ValueError("Expected "+item_name+" in",line,"at",line[p:])
ValueError: ('Expected version spec in', 'enum34; python_version<"3.4"', 'at', '; python_version<"3.4"')

Storing debug log for failure in /tmp/tmpaweUPh
# Command failed: /usr/bin/python -m pip install -q --user 'appdirs' 'colorama>=0.3.3' 'jinja2' 'six' 'enum34; python_version<"3.4"' 'sh>=1.10; sys_platform!="nt"'
# 
# 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
kivy@kivy-VirtualBox:~/Desktop/myapp$ 

我已经升级了appdirs,colorama,jinja2、6,sh等。

我认为主要问题是Buildozer使用的是python版本2.7。如何手动将其更改为python 3+版本?

1 个答案:

答案 0 :(得分:0)

我对buildozer不熟悉,但是在Project description中,我看到了:

  

使用目标Python 3安装Buildozer(默认):

     

...

     

使用目标Python 2安装Buildozer

     
      
  • 遵循与Python 3相同的安装和buildozer初始化

  •   
  • 确保以下行在buildozer.spec文件中。

    # Changes python3 to python2
    requirements = python2,kivy
    
  •   

因此,尝试尝试的一件事是检查buildozer.spec文件中是否有引述的摘录,如果有,请还原它。