Kivy can be run on Android phones using the Kivy Launcher (from the Android store) or an APK can be build using Python for Android (see http://kivy.org/docs/guide/packaging-android.html).
from kivy.app import App from kivy.uix.button import Button class TestApp(App): def build(self): return Button(text='Hello World') if __name__ in ('__main__', '__android__'): TestApp().run()By writing it this way the program can be tested on a desktop before building for an Android.
To test on an Android phone first connect the Android to your machine via USB. Make sure "USB debugging connected" is enabled and "USB connected" is disabled. To enable debugging go to Settings:Application:Development.
Assuming Python4Android is the path to the Python for Android installation and the current directory is called myapp then the following script will build a debug APK and install it on the phone.
currdir=`pwd` cd $Python4Android/dist/default rm bin/myapp* ./build.py --package org.test.myapp --name myapp --version 1.0 --dir $currdir debug adb install -r bin/myapp-1.0-debug.apkThe APK is built in $Python4Android/dist/default/bin and it appears to be necessary to remove the previous build in order to build a new version.
The default orientation is landscape but it can be changed by adding --orientation portrait to the build.
The icon that appears on the phone for your app can be set with --icon $currdir/my_icon.png. Note that the icon must be a .png image.
Kivy has a config file in $HOME/.kivy. So, for example, the screen height and width can be changed to be the same as the Android device.
For debugging it is useful to run adb logcat on your desktop.
Once you have generated a keystore you can sign the app as follows (from inside the bin directory).
/build.py --package org.test.myapp --name myapp --version 1.0 --dir $currdir release jarsigner -verbose -keystore your_key_store myapp-1.0-release-unsigned.apk your_key jarsigner -verify myapp-1.0-release-unsigned.apk zipalign -v 4 myapp-1.0-release-unsigned.apk myapp.apk adb install -r myapp.apkThe first commands builds a release version. The second commands signs the app. The third command verifies the signing. The fourth command aligns bytes in the apps files. The last command installs the app.