Buildozer编译简单的android kivy应用程序,但打包时失败 [英] Buildozer compiles simple android kivy application, but fails while packaging

查看:1011
本文介绍了Buildozer编译简单的android kivy应用程序,但打包时失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是buildozer的输出:

This is the output of buildozer:

buildozer android debug
# Check configuration tokens
# Ensure build layout
# Check configuration tokens
# Preparing build
# Check requirements for android
# Install platform
# Apache ANT found at /root/.buildozer/android/platform/apache-ant-1.8.4
# Android SDK found at /root/.buildozer/android/platform/android-sdk-21
# Android NDK found at /root/.buildozer/android/platform/android-ndk-r9c
# Android packages already installed.
# Check application requirements
# Compile platform
# Distribution compiled.
# Build the application #1
# Package the application
Traceback (most recent call last):
  File "/bin/buildozer", line 5, in <module>
    run()
  File "/usr/lib/python2.7/site-packages/buildozer/__init__.py", line 1215, in run
        Buildozer().run_command(sys.argv[1:])
  File "/usr/lib/python2.7/site-packages/buildozer/__init__.py", line 842, in run_command
    self.target.run_commands(args)
  File "/usr/lib/python2.7/site-packages/buildozer/target.py", line 85, in run_commands
    func(args)
  File "/usr/lib/python2.7/site-packages/buildozer/target.py", line 97, in cmd_debug
    self.buildozer.build()
  File "/usr/lib/python2.7/site-packages/buildozer/__init__.py", line 178, in build
    self.target.build_package()
  File "/usr/lib/python2.7/site-packages/buildozer/targets/android.py", line 397, in build_package
    version = self.buildozer.get_version()
  File "/usr/lib/python2.7/site-packages/buildozer/__init__.py", line 554, in     get_version
    ' (looking for `{1}`)'.format(fn, regex))
    Exception: Unable to find capture version in ./main.py
 (looking for `__version__ = '(.*)'`)

我正在尝试编译一个我设计的简单概率计算器.我无法发布代码,因为我将尝试发布它.但是,我愿意回答使此功能生效所需的任何问题.

I'm trying to compile a simple probability calculator I designed. I can't post the code, because I'm going to try to publish it. However, I'm willing to answer any questions I need to to get this to work.

根据buildozer的输出,我认为,它正在main.py中寻找我不知道需要的行.不幸的是,我不知道那条线是什么样子.但是,在buildozer.spec中,有一行这样写:

Judging by the output of buildozer, I think it's looking for a line in main.py that I didn't know I needed. Unfortunately, I don't have any idea what that line would look like. However, in buildozer.spec, there is a line that says this:

version.regex = __version__ = '(.*)'
version.filename = %(source.dir)s/main.py

第一行看起来像输出中的行,第二行引用了main.py文件.有人知道这些词句是什么意思吗?我是buildozer的新手,所以我不确定在这里做什么.预先感谢您的帮助.

The first line looks like the line in the output and the second references the main.py file. Does anyone know what these lines mean? I am new to buildozer, so I'm not quite sure what to do here. Thanks in advance for your help.

推荐答案

默认情况下,buildozer在main.py中查找格式为__version__ = 'something'的一行.这用于设置apk版本,必填字段.

By default, buildozer looks for a line in your main.py of the form __version__ = 'something'. This is used to set the apk version, a required field.

您可以将此行添加到main.py中,或注释掉版本检查并在buildozer.spec的下一行中取消注释替代版本方法.这样,您就可以在buildozer.spec本身中设置版本字符串.

You can either add this line to your main.py, or comment out the version check and uncomment the alternative version method on the next lines of buildozer.spec. This lets you set the version string in buildozer.spec itself.

这篇关于Buildozer编译简单的android kivy应用程序,但打包时失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆