Testing Your Application using Kivy Launcher

TechJD
4 min readJan 5, 2020
Test your application easily using Kivy Launcher.

This is Part 2 of an ongoing series where I build a flash card app for Chinese characters for Android using Kivy. Part 1 can be found here.

I initially wanted to begin the tutorial with a brief introduction to Kivy and a guide for installation. However, there are so many resources out there to help you get set up, I feel like I would be rehashing a topic that’s been covered better than I could explain it. So, instead, I’ll drop two of the videos I’ve used.

Special thank you to Tech With Tim.
Special thank you to Red Eyed Coder Club.

The first video guides you through installation for Windows. The second video guides you through installation for Linux. As I stated from the beginning, the purpose of this series is to build a working app to be released on the Google Play Store. At the time of writing, all roads to packaging a signed and ready for release APK (“Android Package”) lead through Linux. So instead of showing you just how to install Kivy, in an upcoming part of the series, I will also show you how to install a virtual machine that runs Linux.

For now, let’s focus on the task at hand: getting Kivy up and running, so that we can test it on whatever system we’re using and also our mobile device. As Kivy is written in Python, you need an existing installation of Python on your system. Also, make sure you have pip installed.

python -m pip install --upgrade pip wheel setuptools virtualenv

Next, install the needed dependencies:

python -m pip install docutils pygments pypiwin32 kivy_deps.sdl2 kivy_deps.glew

Next, install kivy:

python -m pip install kivy

Open Python IDLE or your editor of choice, and write the following code:

from kivy.app import App
from kivy.uix.button import Button
class TestApp(App):
def build(self):
return Button(text='Hello world')
TestApp().run()

Save it as ‘main.py’ and run. If everything was installed properly, you should get something like this:

Now, it’s time to install Kivy Launcher. Go to the Play store and download Kivy Launcher on the device you want to test the application on. Create a folder for the test file you just created. Within that folder, you need to create a simple .txt file called ‘android.txt.’ You can write it in Notepad, or whatever text editor you have. In that file, write:

title=<Application Title>
author=<Your Name>
orientation=<portrait|landscape>

You need to input your own information, without the “<>” so it looks like this:

title=My App
author=kevdev
orientation=portrait

IMPORTANT STEP!! After reading many of the reviews for the Kivy Launcher app, it’s apparent to me that instructions on getting that app running through Kivy Launcher aren’t so clear to people. If you’re having trouble finding your test app when you open the Kivy Launcher, pay close attention to this.

Connect your device via USB and access your device’s internal storage. In order for Kivy Launcher to be able to find your test app, you need to make sure the path is as follows:

/sdcard/kivy/<yourapplication>

Again, remove the “<>” and make sure the name replacing “yourapplication” is the same as the name of the new folder you created containing main.py and android.txt. Next, in your device’s internal storage, create a new folder and name it “kivy.” Copy and paste the folder containing your test app into the kivy folder. Launch the Kivy Launcher and you should be able to see your app. If not, it’s more than likely an issue with your path, so when troubleshooting, start there. Let me know in the comments if any issues arise.

Kivy Launcher is great for the initial testing of your app because it’s a relatively quick and painless way to see how your app looks and test some simple functions. However, if your aim is to package and release the app, then you’re eventually going to have to get down and dirty with Buildozer, which is also pretty simple until its time to move on from testing the app to releasing on Play store. The vast majority of my time working on this app was just on figuring out this last step, so I’m very excited to hopefully be able to reduce some of the headache you might experience releasing your app using Kivy. That tutorial though, will have to wait for another day. Until next time!

By the way, you can download the finished project for Hanzi Cards, available now on the Play Store!

--

--

TechJD

Law, programming, and everything in-between! Coming up with fun coding projects with real-world application.