4

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.

PoisonRain
  • 323
  • 1
  • 7
  • 14

2 Answers2

10

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.

inclement
  • 29,124
  • 4
  • 48
  • 60
  • What would I use for 'something'? I'm new to Android development, so I'm not sure what that means. Like 4.4, or kitkat or something like that? – PoisonRain Mar 11 '14 at 21:30
  • No, this is your app's own version. I haven't checked what android mechanism we use for this, but normally it would be something like '0.1' or '1.2' (or whatever), though I think it accepts arbitrary strings (i.e. not just numbers and not just one '.'. – inclement Mar 11 '14 at 21:33
  • Oh wow, okay. Easy enough then. Thanks! It's failing again, though. I think I'm missing some 32-bit libraries (or so another question says) but I'm running Fedora with yum, rather than Ubuntu or something with apt-get so I'm not sure what to install for those. Do you know which ones to get? – PoisonRain Mar 11 '14 at 21:40
  • This should be submitted as a new question. – brousch Mar 12 '14 at 13:32
0

Add version = '0.1' at the top of your main.py file so you can package your application without any error.