Deploy

Date: February 23rd 2016
Last updated: February 23rd 2016

1. Create application

#!/bin/python3.4
#basicapp.py

import kivy
kivy.require('1.9.1') 
# replace with your current kivy version

from kivy.app import App
from kivy.uix.button import Button

class MyApp(App):
    def build(self):
        return Button(text='Hello World')

if __name__ == '__main__':
    MyApp().run()

2. Test basicapp.py runs

# Run the kivy app from terminal
python basicapp.py

Save the file as main.py and execute buildozer. The first time is going to take a long time because a number of applications are going to be installed. It should be faster the next time buildozer is used.

3. Deploy main.py to phone

mv basicapp.py main.py #replace basic app as main.py
buildozer init

# modify buildozer file called "buildozer.spec"
# make sure phone is connected

# build and deploy
buildozer android debug deploy

At this stage I had a lot of problems. Spoiler... I HAD TO TURN ON USB DEBUGGING MODE ON MY PHONE.

Here are some things I tried:
The problem: I could not get my application across to my phone (HTC One SV, Android 4.2.2). The first thing I noted was that my phone wasn't found when buildozer was trying to deploy.

I tried using HTC sync manager on a platform running windows OS. However, python-to-android is not supported by windows so I bailed on this idea and went back to my linux OS.

Next I checked the connection to my computer:

mtp (Media Transfer Protocol)

sudo apt-get install mtp-tools
mtp-detect 

# device not found

adb (android development bridge):

sudo apt-get install android-tools-adb
adb kill-server
adb start-server
adb devices

# device not found
# -waiting for device-

Then, I tried an emulator to avoid using a phone, but I had space issues so I scrapped this idea.

# Install emulator
sudo apt-get install libgl1-mesa-dev
sudo wget http://dl.google.com/android/ \
    android-sdk_r23.0.2-linux.tgz
sudo tar -zxvf android-sdk_r23.0.2-linux.tgz
cd android-sdk-linux
sudo tools/android

Finally I checked my phone. After turning on USB debugging mode, buildozer deploy worked as expected.

Settings> About> Software Information> More
tap Build number seven times
# confirm debugging mode
# reconnect phone to computer and check connection
mtp-detect

results matching ""

    No results matching ""