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

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

问题描述

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.

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

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.

解决方案

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.

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天全站免登陆