简体   繁体   English

使用buildozer构建Kivy APK的问题

[英]Issues with building Kivy APK with buildozer

I wrote a simple Kivy app on Mac OsX that replicates buttons: 我在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()

However, when I initiate the buildozer file with buildozer init, and run it with buildozer android debug I get the following error 但是,当我使用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__ = ['"](.*)['"]`)

I've tried many solutions including switching the locations of the file, changing the version, adding __version__ = "1.2.0" to main.py file, and all with no success. 我尝试了很多解决方案,包括切换文件的位置,更改版本,将__version__ = "1.2.0"添加到main.py文件,所有这些都没有成功。 What am I doing wrong? 我究竟做错了什么?

Buildozer只能在Linux上运行android包,这个错误是因为你在OSX上

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM