Building Kivy app for android on WSL (Windows Subsystem for Linux)

January the 3rd, 2019

Enable WSL in Windows (google how)

Install desired linux distribution via Microsoft Store (search for Ubuntu there for example)

Install packages required for build:

sudo apt install python3 python3-pip unzip zip openjdk-8-jdk libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev libgstreamer1.0-dev libffi-dev lld

Install required python packages:

pip3 install python-for-android cython

Download and extract Andoird SDK tools (tools only) and Android NDK (google both of these)

Install needed API via android-sdk-linux/tools/bin/sdkmanager:

sdkmanager "platform-tools" "platforms;android-28"

Install build tools via android-sdk-linux/tools/bin/sdkmanager:

sdkmanager "build-tools;29.0.0"

Create environment variables required for p4a build:

ANDROIDSDK=/mnt/c/Users/hacker/android-sdk-linux

ANDROIDNDK=/mnt/c/Users/hacker/android-ndk-r20b-linux

ANDROIDAPI="28" # Target API version of your application

NDKAPI="21" # Minimum supported API version of your application

Build apk:

p4a apk --private . --package=org.anonymous.new_world_order --name="New World Order" --version 7 --bootstrap=sdl2 --requirements=python3,kivy