Home > Blockchain >  I am new to Kivy and using buildozer.I making an apk but it's crash when i open it
I am new to Kivy and using buildozer.I making an apk but it's crash when i open it

Time:07-30

from kivy.lang import Builder

from kivymd.app import MDApp
from kivymd.uix.label import MDLabel
from kivy.core.text import LabelBase
from kivymd.font_definitions import theme_font_styles

import datetime

x = datetime.datetime.now()
now = datetime.date(x.year,x.month,x.day)
uwu = datetime.date(2019,10,19)
delta = now - uwu

KV = '''
MDScreen:
    FitImage:
        source:"Luv.jpg"
    MDBoxLayout:
        id: box
        orientation: "vertical"
'''


class Test(MDApp):
    def build(self):
        
        LabelBase.register(name='Loving', 
                   fn_regular='loving.ttf')
        theme_font_styles.append('Loving')
        self.theme_cls.font_styles["Loving"] = ["Loving",65,False,0.15,]
        screen = Builder.load_string(KV)
        screen.ids.box.add_widget(
                                MDLabel(
                                    text=f'{delta.days} days moahhh!',
                                    halign="center",
                                    valign="bottom",
                                    theme_text_color="Error",
                                    font_style="Loving",
                                )
                            )
        return screen


Test().run()

I used datetime kivy and kivymd to create this program I use the image to set the background and change the font I don't know exactly which libraries should be included in buidozer's requriment. What are the things I need to include in the buildozer requirement?

CodePudding user response:

If you are using pictures in your app, you must include pillow in requirements.

CodePudding user response:

I see two possible problems in your code.

First, you're using the kivy and the kivymd package. Did you specify these in the buildozer.spec file as requirements?
Further, you're using a loving.ttf font file. Normally, .ttf files are not automatically included in the build process of buildozer, you need to state that in source.include_exts = ..., also in your buildozer.spec file.

Also, it might be helpful to connect your phone and enable USB-debugging. Then, you can use adb (Android Debug Bridge), e.g. to display all log messages of your phone (including the error message of your app) by typing adb logcat.

  • Related