Search code examples
pythonandroidkivykivy-language

Simple Kivy App that is deployed and has no errors, but when opened has a black screen


I created a simple app in Kivy. When I debug and deploy the app everything is fine no errors, but when I download the file on my phone and open it. Nothing happens. https://github.com/r0me777/AnimalNoisesApp.git Github Please help.

Python File:

import kivy
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from kivy.uix.anchorlayout import AnchorLayout
from kivy.uix.stacklayout import StackLayout
from kivy.uix.gridlayout import GridLayout
from kivy.metrics import dp
from kivy.core.audio import SoundLoader


class AppLayout(GridLayout):
    def play_music(self, MusicName):
        music = SoundLoader.load(MusicName)

        if music:
            music.play()


class ButtonApp(App):
    pass


if __name__ == "__main__":
    ButtonApp().run()

Kv File:

AppLayout:

<AppLayout>:
    cols:2
    rows:2
    Label:

        text: "Press the Animals!!"
        size: self.texture_size

    GridLayout:
        cols: 1
        Button:
            id: Bee
            background_normal: "bee.png"
            on_release: root.play_music("BeeNoise.mp3")
        Button:
            id: Bird
            background_normal: "bird.png"
            on_release: root.play_music("BirdNoise.mp3")
    #    Button:
    #        background_normal: "cow.png"
    #        on_release: root.play_music("BeeNoise.mp3")
    #    Button:
    #        background_normal: "dog.png"
    #        on_release: root.play_music("BeeNoise.mp3")

    GridLayout:
        cols: 1
        Button:
            id: Elephant
            background_normal: "elephant.png"
            on_release: root.play_music("ElephantNoise.mp3")
        Button:
            id: Frog
            background_normal: "frog.png"
            on_release: root.play_music("FrogNoise.mp3")
      #  Button:
      #      background_normal: "horse.png"
      #      on_release: root.play_music("BeeNoise.mp3")
      #  Button:
      #      background_normal: "koala.png"
      #      on_release: root.play_music("BeeNoise.mp3")
    GridLayout:
        cols: 1
        Button:
            id: Lion
            background_normal: "lion.png"
            on_release: root.play_music("LionNoise.mp3")
        Button:
            id: Seal
            background_normal: "walrus.png"
            on_release: root.play_music("SealNoise.mp3")
    #    Button:
    #        background_normal: "bird.png"
    #        on_release: root.play_music("BeeNoise.mp3")
    #    Button:
    #        background_normal: "bird.png"
    #        on_release: root.play_music("BeeNoise.mp3")

Both Pretty Simple, and when I bulldozer it no errors. I have no idea what is causing this.


Solution

  • I changed the .kv file from Button.kv to button.kv. Although audio issues have come around, as I cannot hear anything from the app but it got the display working so my question was basically solved.