使用buildozer构建Kivy APK的问题

时间:2015-09-05 16:46:44

标签: android python kivy buildozer

我在Mac OsX上写了一个简单的Kivy应用程序来复制按钮:

import kivy
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.boxlayout import BoxLayout






class ButtonApp(App):

    def add_button(self, none):
        button = Button(text='Press Me too!')
        button.bind(on_press=self.add_button)
        self.b.add_widget(button)


    def build(self):
        self.b = BoxLayout()
        button = Button(text="Press me!")
        button.bind(on_press=self.add_button)
        self.b.add_widget(button)
        return self.b


if __name__ == "__main__":

    ButtonApp().run()

然而,当我使用buildozer init启动buildozer文件,并使用buildozer android debug运行它时,我收到以下错误

  self.target.build_package()
  File "/usr/local/lib/python2.7/site-packages/buildozer/targets/android.py", line 517, in build_package
    version = self.buildozer.get_version()
  File "/usr/local/lib/python2.7/site-packages/buildozer/__init__.py", line 675, in get_version
    ' (looking for `{1}`)'.format(fn, regex))
Exception: Unable to find capture version in ./main.py
 (looking for `__version__ = ['"](.*)['"]`)

我尝试了很多解决方案,包括切换文件的位置,更改版本,将__version__ = "1.2.0"添加到main.py文件,所有这些都没有成功。我做错了什么?

1 个答案:

答案 0 :(得分:0)

Buildozer仅适用于linux上的android包,这个错误是因为你在OSX上