5

It's not easy to install buildozer on Ubuntu 13.10. I reinstalled Ubuntu several times and now I'd like to share how I installed buildozer.

I got the following errors from buildozer:

  1. ./distribute.sh not found --> no fix found (that's why I reinstalled Ubuntu twice, probably an issue with python installation but I'm not sure)
  2. _add_java_src() fails --> adding the correct Java JDK path fixed it
prosti
  • 42,291
  • 14
  • 186
  • 151
AWolf
  • 8,770
  • 5
  • 33
  • 39

4 Answers4

4

The procedure described below was working perfectly for me:

I've installed it in a fresh installation of Ubuntu 13.10 (32bit) inside a virtual machine (VMware player) in Windows 7 (64bit) host system.

I decided to use 32 bit because the VM uses not that much RAM and a 64bit system is not needed. But 64bit Ubuntu will probably also work (not tested). I uploaded the zip archive of the VMWare files to google drive (password in ubuntu for root user alexander is UbuntuBuildozer)

You can find the zip-file here: https://drive.google.com/file/d/0B5m9_RVHCpL-YmxPVnVaYWZyZ2s/edit?usp=sharing

  1. install Python-Kivy (http://kivy.org/docs/installation/installation-linux.html#ubuntu-11-10-or-newer) with

    $ sudo add-apt-repository ppa:kivy-team/kivy

    $ sudo apt-get update

    $ sudo apt-get install python-kivy

  2. install pip, if you haven't got it:

    $ sudo apt-get install python-pip python-dev build-essential

  3. prerequisites for buildozer: zlib, Git, Cython and JDK is required

    $ sudo apt-get install zlib1g-dev git-core cython openjdk-7-jdk

    install Java JDK guide (http://tecadmin.net/install-java-jdk-ubuntu/#)

  4. install buildozer (https://github.com/kivy/buildozer)

    $ sudo pip install buildozer

  5. initialize buildozer and start with debug (just to install Andriod SDK, NDK & ANT - no main.py needed yet, this takes several minutes):

    $ buildozer init

    $ buildozer android debug

  6. If buildozer fails at _add_java_src(): Add JDK path in /home/yourusername/.bashrc - add these lines at the end (important use 1.x JDK and not java-7 path):

    export PATH=$PATH:/usr/lib/jvm/java-1.6.0-openjdk-i386/bin

    export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-i386

  7. Now go to your apps main.py and do the following commands:

    $ buildozer init

    (edit buildozer.spec and change your app name and check the versioning on line 28/29 or line 32 --> depends on your main.py code
    see SO answer to Buildozer compiles simple android kivy application, but fails while packaging)

    $ buildozer android debug deploy run

Community
  • 1
  • 1
AWolf
  • 8,770
  • 5
  • 33
  • 39
  • as explained in http://kivy.org/docs/installation/installation.html it's better to install cython using: `sudo pip install --upgrade cython` so that you are sure you get the latest update. – Ehsan88 Jun 19 '14 at 22:43
  • @EhsanAbd It might have changed cause I had to downgrade cython from 0.22 to 0.20, so I would advice `sudo apt-get install cython=0.20*` – Vincent Feb 20 '15 at 17:33
  • I followed your instructions and I gor #Aidl not found, please install it. – Yannis Dec 02 '15 at 14:31
2

Note that you don't actually need Kivy if all you want to do is compile APKs. I use the following script to install only Buildozer on Ubuntu 13.10 64bit.

#!/bin/sh

# Install necessary system packages
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y build-essential git zlib1g-dev python2.7 python2.7-dev libncurses5:i386 libstdc++6:i386 zlib1g:i386 openjdk-7-jdk unzip

# Bootstrap a current Python environment
sudo apt-get remove --purge -y python-virtualenv python-pip python-setuptools
wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O - | sudo python2.7
rm setuptools*.zip
sudo easy_install-2.7 -U pip
sudo pip2.7 install -U virtualenv

# Install current version of Cython
sudo apt-get remove --purge -y cython
sudo pip2.7 install -U cython

# Install Buildozer from master
sudo pip2.7 install -U git+https://github.com/kivy/buildozer.git@master
brousch
  • 1,064
  • 5
  • 10
  • this script failed for me since `pip` was not resolved by my environment. I have found it to be more compatible using `apt-get` to install python packages, just as @AWolf has suggested. – ecoe Feb 18 '16 at 02:36
1

Check out this video by Erik Sandberg as he explains it really well. Then you will need to go into the bin directory to find your compiled APK. Let me know by adding a comment if this doesn't work.

LucioRandy
  • 220
  • 1
  • 19
  • This is a nice coincidence. I have seen that video and make the steps few days ago. I have stuck [here](https://stackoverflow.com/questions/59593341/buildozer-build-failed-couldnt-find-executable-for-cc) and created a bounty for it. – xralf Oct 18 '20 at 17:15
0

Buildozer itself doesn't depend on any library, and works on Python 2.7 and >= 3.3. Depending on the platform you want to target, you might need more tools installed.

Buildozer tries to give you hints or tries to install few things for you, but it doesn't cover every situation.

The official documentation covers more but here is how to do it in Ubuntu 16.04 64-bit:

sudo pip install --upgrade cython==0.21
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install build-essential ccache git libncurses5:i386 libstdc++6:i386 libgtk2.0-0:i386 libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 python2.7 python2.7-dev openjdk-8-jdk unzip zlib1g-dev zlib1g:i386
prosti
  • 42,291
  • 14
  • 186
  • 151