我在 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 文件,但都没有成功。我究竟做错了什么?