Skip to content

Instantly share code, notes, and snippets.

@SpotlightKid
Last active June 29, 2022 04:28
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SpotlightKid/2a68300733d96b027c5f7a3ea5c79556 to your computer and use it in GitHub Desktop.
Save SpotlightKid/2a68300733d96b027c5f7a3ea5c79556 to your computer and use it in GitHub Desktop.
Building your Kivy App for Android

Building your Kivy App for Android

Requirements

You need:

  • A reasonably modern Android device with a USB port
  • A micro USB cable
  • A fast internet connection
  • Plenty of disk space
  • Lots of RAM
  • Patience and a few hours of your time

Also:

Buildozer

https://github.com/kivy/buildozer

Installation:

mkvirtualenv -p python2.7 buildozer
pip install "Cython==0.25"
# Important: install Cython and Kivy in two steps!
pip install "kivy==1.10.0"   # for testing on build host
git clone https://github.com/kivy/buildozer.git
cd buildozer
wget -O buildozer-android-project-properties.diff https://git.io/v914C
patch -p1 -i buildozer-android-project-properties.diff
sudo python setup.py install

For installation pre-requirements, please check:

https://kivy.org/docs/installation/installation-linux.html#installation-in-a-virtual-environment

Building your app

Example project:

Preparing your project

cd <yourapp>
buildozer init
$EDITOR buildozer.spec
  • Set at least title, package.name, package.domain, version and author.
  • If your app needs additional files besides those with extensions, which get included by default, adapt source.include_exts and/or source.include_patterns.
  • If your app needs additional Python packages besides Kivy and those included by Python-for-Android by default, adapt the requirements setting.
  • Change orientation if necessary.
  • Uncommment icon.filename setting and adjust path to icon file.

Preparing your device

  • Enable developer settings (search internet for "<device> enable developer settings").
  • Enable USB debugging in the developer settings.
  • Connect the device via USB to your build host.

Building the APK

Start:

buildozer android debug deploy run

... then go for lunch.

After a while an APK will have been built. buildozer then installs the APK via adb on the connected Android device and starts it.

The APK is also stored in your project below the bin directory and can be re-installed on the Android device with adb install <APK file>.

Resources

@rakin406
Copy link

THANK YOU VERY MUCH :)

@bsjaramillo
Copy link

nice

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