简体   繁体   中英

buildozer kivy app wont run on android with external kv file

I'm newbie in coding with python/kivy. I have a problem building an android app via kivy buildozer.

First of all, if I build the app and I use kivy like this for example:

self.asdbut = Button(text="xxxxxx", font_size="70sp")
self.asdbut.bind(on_press=self.aaaaa)
self.add_widget(self.asdbut)

It works on both on pc and android phone.

But if I use kivy builder for external or inner script kv language the app runs on pc but not in android. So I guess I have to somehow add the kivy.lang.builder to the apk via buildozer init file. How can I achive that?

PS I've found a line in buildozer spec that say's :

# (list) Application requirements
requirements = kivy

So i've tried to include there builder but it didn't work.

Builder is class, not package. For loading either name it like your App class ( class My(App): -> my.kv ), or load with Builder this way:

Builder.load_string('''
<My>:
    property: value
''')

or

Builder.load_file(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'my.kv'))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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