Search code examples
androidkivyapk

Kivy APK Does Not Run on Android Phone


I have built an APK from the Kivy/Buildozer VM with a very simple program to test it.

here is the Python file:

import kivy
kivy.require('1.9.0')
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.uix.popup import Popup


class MyPopup(Popup):
    pass


class Test(Widget):
    pass


class KivyTestApp(App):
    def build(self):
        return Test()


app = KivyTestApp()
app.run()

and the Kivy file:

#: import Factory kivy.factory.Factory

<MyPopup>:
    title: 'Test'
    size_hint: None, None
    size: 400, 400

<Test>:
    Button:
        id: but
        size: root.width, root.height
        background_normal: ''
        background_color: .5, .7, .9, 1
        text: 'Press me to open the popup'
        pos: 0, 0
        on_press: Factory.MyPopup().open()

When I run the APK of this code, I simply get a black screen. Note: I am not running this in Kivy Launcher. This is a successfully built APK from buildozer.


Solution

  • Since your kv file is named KivyTest.kv, your app will not load your kv file and the app will be just a blank screen. You must change the name of the file to kivytest.kv. See the documentation.