Skip to content

Instantly share code, notes, and snippets.

@kyudorimj
Last active April 5, 2022 07:49
Show Gist options
  • Save kyudorimj/01eb862df896bff89e90c4496eff093d to your computer and use it in GitHub Desktop.
Save kyudorimj/01eb862df896bff89e90c4496eff093d to your computer and use it in GitHub Desktop.
Kivy-To-Android: Build your Kivy Application to Android Package APK

KIVY TO ANDROID USING BUILDOZER IN WINDOWS 7/8/10

A straight forward step by step guide in building Kivy application into android package (.apk file) using buildozer in Windows

Steps

  • Open your browser and navigate to Google Colab
  • Create new notebook by clicking File > New Notebook
  • Click the +Code in the upper part of the screen to add new cell
  • Add the following to a cell

Cells

  1. The following cells are to install needed modules that will run the builder (buildozer, python, git).

    !sudo apt install git
    !git clone https://github.com/kivy/buildozer.git
    !sudo apt-get install python3
    !sudo apt-get install python3-setuptools
    cd buildozer
    !sudo python3 setup.py install
    cd ..
  2. After installation of buildozer, python and git, you can now clone your project repository that you want to build.
    You can also upload your project to colab by zipping it and unzipping in the runtime storage if your project is not on github.

    !git clone github.com/username/repositorytitle
    cd AppName
  3. The buildozer init command will initialized a new buildozer.spec file. This file contains everything about the application you will build, such as app title, domain and package name.
    Open the file to edit it based on the app requirements.

    !buildozer init

    Sample values in the buildozer.spec file

    title = Race Game
    package.name = racegame
    package.domain = com.dev
  4. Download updates and install other modules needed for the build.

    !sudo apt update
    !sudo apt install -y git zip openjdk-8-jdk python3-pip autoconf libtool pkg-config zlib1g-dev libncurses5-dev libncursesw5-dev libtinfo5 cmake libffi-dev
    !pip3 install --user --upgrade cython virtualenv
    !sudo apt-get install cython
  5. Build the application using the command:

    !buildozer -v android debug

Run each cell. Make sure to don't skip any installation because it will be needed in the build.

That's it! Congratulations!

With that, you will now be able to see the built .apk file in the /bin directory. Copy it to your phone and install. Make sure to allow sources in installing the .apk files.

You have successfully built your Kivy Application into Android!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment