Building for Android?

289 views
Skip to first unread message

Richard Jones

unread,
Mar 21, 2015, 6:32:43 AM3/21/15
to kivy-...@googlegroups.com
Hi all,

I've previously successfully built a kivy project for Android (2 years ago) but I've come back to it and found myself quite stymied.

My native OS is OS X (10.9) and the python-for-android build ("./distribute.sh -m kivy") breaks trying to build Python at the moment. Has anyone got the build environment working on OS X?

I've also downloaded the VM for VirtualBox, which also fails to build (same distribute.sh command as above). Has anyone got the VM working currently? I updated the git checkout of python-for-android in the VM just to see if that would work, but that didn't help.


     Richard

ps. I'll be happy to talk details, but right now I'm just wondering whether anyone has it working at all, and under what conditions they have it working.

Richard Jones

unread,
Mar 21, 2015, 9:16:44 PM3/21/15
to kivy-...@googlegroups.com
I finally got the toolchain working after several issues. Here's what I've learned, if it helps anyone else.

- the Virtual Machine provided by the kivy project just doesn't work any longer, and should be fixed or not promoted
- python-for-android doesn't invoke mktemp correctly on OS X resulting in pollution of environment variables and strange errors ;) (PR submitted ... oh, and merged, thanks Mathieu!)
- cython install requires cython 0.21.2 at the latest*
- the android NDK doesn't support android SDK 22, so that caused some bizarro errors (PR against python-for-android submitted to help debug that, as the errors are not at all obvious way down the track), so I backed out to SDK 21...
- but then 21 still doesn't work with compiling Python, and I had to back even further out to SDK 19

However...

The key problem, which prevented buildozer and everything else from working, was that I had in my .profile:

    # tell clang to shut up about unused arguments
  export CFLAGS=-Qunused-arguments
  export CPPFLAGS=-Qunused-arguments

These were required back when OS X 10.9 was first released because without them you couldn't build Python :/
They conflicted with the arm compiler in the Android NDK, and removing them allowed things to progress.

I'm now using buildozer quite happily, thanks for such a great tool! :)


     Richard

* yes, this is mentioned in the kivy install page, but I didn't build kivy, I used the pre-build OS X version, so for packaging I need to install cython and missed the warning about versions on the kivy installation page

phenotyp...@gmail.com

unread,
Apr 3, 2015, 1:14:17 PM4/3/15
to kivy-...@googlegroups.com
Hi,

I'm building my android apps with buildozer on OSX 10.9 but for a while now I just can't get a well functioning app anymore, however it worked before. 
The problem is that the app is not turning correctly anymore, it always stays in the same layout and parts of the screen are not visible anymore. I have tried everything to fix this but it just does not work. However somehow I feel I'm the only one with this issue. Would be awesome you had a good reason or idea for me. I have the same problem on windows 8.1 

thanks for the help

Carsten Thielepape

unread,
Apr 10, 2015, 9:11:10 AM4/10/15
to kivy-...@googlegroups.com
Ur not the only one, I ant buld any kivy app anymore

qua non

unread,
Apr 10, 2015, 9:26:21 AM4/10/15
to kivy-...@googlegroups.com
@richard there is a new VM being uploaded to the servers as we speak.

Should be up by tonight.

@Carsten @phenotype there are some issues with bulldozer, iOS. Some code was merged that did some specific changes that only worked on linux. So bulldozer is currently broken on linux, we know about the issue and will be fixing it asap, in the mean time you guys can try out the new VM that should be uploaded today. I will provide the link once we have the vm uploaded. 



--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

qua non

unread,
Apr 10, 2015, 9:30:36 AM4/10/15
to kivy-...@googlegroups.com
Correction, issues are with python-forandroid on OsX not bulldozer for iOS  target.

Carsten Thielepape

unread,
Apr 10, 2015, 9:43:53 AM4/10/15
to kivy-...@googlegroups.com
For Andorid? Very much appreciated!

Richard Jones

unread,
Apr 10, 2015, 3:54:11 PM4/10/15
to kivy-...@googlegroups.com

Awesome, thanks !

qua non

unread,
Apr 11, 2015, 12:46:17 AM4/11/15
to kivy-...@googlegroups.com
Hey folks,

Thsirtman(Gabriel Pettier) worked hard on producing this vm here http://pub.tshirtman.fr/buildozer.7z we need people to test it a bit before we add a link to it on the front page. Could you guys please test and let us know how it works.




Carsten Thielepape

unread,
Apr 11, 2015, 3:32:25 AM4/11/15
to kivy-...@googlegroups.com
Hi,

a quick test without success:

It's stucking now somewhere else. Please let me know if you need a full log.

building 'jnius' extension
creating build
creating build
/temp.linux-x86_64-2.7
creating build
/temp.linux-x86_64-2.7/jnius
arm
-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer --sysroot /home/kivy/.buildozer/android/platform/android-ndk-r9c/platforms/android-14/arch-arm -DNDEBUG -DANDROID -mandroid -fomit-frame-pointer --sysroot /home/kivy/.buildozer/android/platform/android-ndk-r9c/platforms/android-14/arch-arm -fPIC -I/home/kivy/workbd/.buildozer/android/platform/python-for-android/build/python-install/include/python2.7 -c jnius/jnius.c -o build/temp.linux-x86_64-2.7/jnius/jnius.o
arm
-linux-androideabi-gcc: error: jnius/jnius.c: No such file or directory
arm
-linux-androideabi-gcc: fatal error: no input files
compilation terminated
.
error
: command 'arm-linux-androideabi-gcc' failed with exit status 1


buildozer.spec
Message has been deleted

jetpack

unread,
Apr 11, 2015, 8:52:06 AM4/11/15
to kivy-...@googlegroups.com
hey qua-non do you have another stable download link,, a torrent perhaps. Download stops midway. thanks!

werton

unread,
Apr 11, 2015, 10:26:03 AM4/11/15
to kivy-...@googlegroups.com
This virtual machine works fine for me. Successfully built my app, thanks a lot.

суббота, 21 марта 2015 г., 18:32:43 UTC+8 пользователь Richard Jones написал:

Carsten Thielepape

unread,
Apr 12, 2015, 3:39:19 AM4/12/15
to kivy-...@googlegroups.com
Hello,

made a further try. Still no success, I added the logfile.
Lines 2501 and 5723 might be on interest:
buildozer.log

qua non

unread,
Apr 12, 2015, 10:31:10 AM4/12/15
to kivy-...@googlegroups.com
@Carsten, the log you attached says the build was successful, the only issue I see is::

 build.xml: Failed to find version-tag string. File must be updated.

Make sure you have version specified in your main.py or in bulldozer.spec


--

Gabriel Pettier

unread,
Apr 12, 2015, 10:31:54 AM4/12/15
to kivy-...@googlegroups.com
Hey, it's a bit confusing, the attached log says compilation was
successful, are you sure this is the right one?

As for a better link, or a torrent, that can be done, but it may not be
very useful before the VM is not more checked and documented (there is
no README and things of this kind in it yet)
signature.asc

Carsten Thielepape

unread,
Apr 12, 2015, 3:16:19 PM4/12/15
to kivy-...@googlegroups.com
Hi,

maybe you missed th follwoing lines:

Line:12201


arm-linux-androideabi-gcc: error: jnius/jnius.c: No such file or directory
arm-linux-androideabi-gcc: fatal error: no input files
compilation terminated.
error: command 'arm-linux-androideabi-gcc' failed with exit status 1

Looks for like compililation did not finish.

I logged a further try to make it simple and and make it repeatable:

- Fresh "buildozer" VMBO package.
- in the /home/kivy folder
- Created a folder work/src
- Cretaed a folder workbd
- Copied the compass example into the work/src folder
- Copied the (attached) buildoer.spec into the workbd folder
Changed into the workbd folder
Eecuted the following line: buildozer -v android debug  > buildozer.log 2>&1

- Compilation went on the same error
- apk does not start

Should be repeatable
buildozer2.log
buildozer.spec

phenotyp...@gmail.com

unread,
Apr 13, 2015, 3:13:22 PM4/13/15
to kivy-...@googlegroups.com
I tried with the VB but unfortunately the TextInput bug persists. I think this a a really important bug. 
Apart from that the build worked fine in the VB.

I really hope you can fix buildozer for mac as soon as possible. 



On Saturday, March 21, 2015 at 11:32:43 AM UTC+1, Richard Jones wrote:

Carsten Thielepape

unread,
Apr 14, 2015, 1:54:03 AM4/14/15
to kivy-...@googlegroups.com
Hi,

as the VMBOX seems to work in principle for others, it might be caused by either my spec file or my folder structure (or both).

Could somebody please provide a working buildozer.spec file for this VMBOX image, together with the folder structure he used?

Thanks!


Am Samstag, 21. März 2015 11:32:43 UTC+1 schrieb Richard Jones:

jetpack

unread,
Apr 14, 2015, 6:41:48 PM4/14/15
to kivy-...@googlegroups.com
Have you tried building a minimal app first. build a script with just a label or button and see if that works.

Carsten Thielepape

unread,
Apr 15, 2015, 1:25:30 AM4/15/15
to kivy-...@googlegroups.com
Hi,

I used the compass example, which is fairly simple. When I read the logs, it looks like building the distribution  fails, which has nothing to do with the app code.

Still gettinng a working buildozer spec for this vmbox image includimg the used folder structure would be very appreciated.

jetpack

unread,
Apr 15, 2015, 10:59:36 AM4/15/15
to kivy-...@googlegroups.com
I haven't tried compiling any app with complex folder structures. Here's a spec file that worked for a simple one label app(idk if its gonna help you), i built with buildozer. If you think the problem is with your .spec file and folder structure, then you should post screen shot of your folder structure and copy of your spec file. Maybe someone more experienced will be able to look into it and help you out. Cheers!

spec file :

[app]

# (str) Title of your application
title = My Application

# (str) Package name
package.name = myapp

# (str) Package domain (needed for android/ios packaging)
package.domain = org.test

# (str) Source code where the main.py live
source.dir = .

# (list) Source files to include (let empty to include all the files)
source.include_exts = py,png,jpg,kv,atlas

# (list) Source files to exclude (let empty to not exclude anything)
#source.exclude_exts = spec

# (list) List of directory to exclude (let empty to not exclude anything)
#source.exclude_dirs = tests, bin

# (list) List of exclusions using pattern matching
#source.exclude_patterns = license,images/*/*.jpg

# (str) Application versioning (method 1)
version.regex = __version__ = ['"](.*)['"]
version.filename = %(source.dir)s/main.py

# (str) Application versioning (method 2)
# version = 1.2.0

# (list) Application requirements
# comma seperated e.g. requirements = sqlite3,kivy
requirements = kivy==stable

# (list) Garden requirements
#garden_requirements =

# (str) Presplash of the application
#presplash.filename = %(source.dir)s/data/presplash.png

# (str) Icon of the application
#icon.filename = %(source.dir)s/data/icon.png

# (str) Supported orientation (one of landscape, portrait or all)
orientation = landscape

# (bool) Indicate if the application should be fullscreen or not
fullscreen = 1


#
# Android specific
#

# (list) Permissions
#android.permissions = INTERNET

# (int) Android API to use
#android.api = 14

# (int) Minimum API required (8 = Android 2.2 devices)
#android.minapi = 8

# (int) Android SDK version to use
#android.sdk = 21

# (str) Android NDK version to use
#android.ndk = 9c

# (bool) Use --private data storage (True) or --dir public storage (False)
#android.private_storage = True

# (str) Android NDK directory (if empty, it will be automatically downloaded.)
#android.ndk_path =

# (str) Android SDK directory (if empty, it will be automatically downloaded.)
#android.sdk_path =

# (str) python-for-android git clone directory (if empty, it will be automatically cloned from github)
#android.p4a_dir =

# (list) python-for-android whitelist
#android.p4a_whitelist =

# (str) Android entry point, default is ok for Kivy-based app
#android.entrypoint = org.renpy.android.PythonActivity

# (list) List of Java .jar files to add to the libs so that pyjnius can access
# their classes. Don't add jars that you do not need, since extra jars can slow
# down the build process. Allows wildcards matching, for example:
# OUYA-ODK/libs/*.jar
#android.add_jars = foo.jar,bar.jar,path/to/more/*.jar

# (list) List of Java files to add to the android project (can be java or a
# directory containing the files)
#android.add_src =

# (str) python-for-android branch to use, if not master, useful to try
# not yet merged features.
#android.branch = master

# (str) OUYA Console category. Should be one of GAME or APP
# If you leave this blank, OUYA support will not be enabled
#android.ouya.category = GAME

# (str) Filename of OUYA Console icon. It must be a 732x412 png image.
#android.ouya.icon.filename = %(source.dir)s/data/ouya_icon.png

# (str) XML file to include as an intent filters in <activity> tag
#android.manifest.intent_filters =

# (list) Android additionnal libraries to copy into libs/armeabi
#android.add_libs_armeabi = libs/android/*.so
#android.add_libs_armeabi_v7a = libs/android-v7/*.so
#android.add_libs_x86 = libs/android-x86/*.so
#android.add_libs_mips = libs/android-mips/*.so

# (bool) Indicate whether the screen should stay on
# Don't forget to add the WAKE_LOCK permission if you set this to True
#android.wakelock = False

# (list) Android application meta-data to set (key=value format)
#android.meta_data =

# (list) Android library project to add (will be added in the
# project.properties automatically.)
#android.library_references =

#
# iOS specific
#

# (str) Name of the certificate to use for signing the debug version
# Get a list of available identities: buildozer ios list_identities
#ios.codesign.debug = "iPhone Developer: <lastname> <firstname> (<hexstring>)"

# (str) Name of the certificate to use for signing the release version
#ios.codesign.release = %(ios.codesign.debug)s


[buildozer]

# (int) Log level (0 = error only, 1 = info, 2 = debug (with command output))
log_level = 2

# (int) Display warning if buildozer is run as root (0 = False, 1 = True)
warn_on_root = 1


#    -----------------------------------------------------------------------------
#    List as sections
#
#    You can define all the "list" as [section:key].
#    Each line will be considered as a option to the list.
#    Let's take [app] / source.exclude_patterns.
#    Instead of doing:
#
#[app]
#source.exclude_patterns = license,data/audio/*.wav,data/images/original/*
#
#    This can be translated into:
#
#[app:source.exclude_patterns]
#license
#data/audio/*.wav
#data/images/original/*
#


#    -----------------------------------------------------------------------------
#    Profiles
#
#    You can extend section / key with a profile
#    For example, you want to deploy a demo version of your application without
#    HD content. You could first change the title to add "(demo)" in the name
#    and extend the excluded directories to remove the HD content.
#
#[app@demo]
#title = My Application (demo)
#
#[app:source.exclude_patterns@demo]
#images/hd/*
#
#    Then, invoke the command line with the "demo" profile:
#
#buildozer --profile demo android debug

Carsten Thielepape

unread,
Apr 15, 2015, 11:09:30 AM4/15/15
to kivy-...@googlegroups.com
Thanks,

I don't think its about the folder structure of the app. The compass demo is simple as well.

I would be interested in:

The folder location of the spec file
The folder location of the main.py

(I am using different folder by now..)


Am Samstag, 21. März 2015 11:32:43 UTC+1 schrieb Richard Jones:

Carsten Thielepape

unread,
Apr 15, 2015, 4:08:24 PM4/15/15
to kivy-...@googlegroups.com
Hi Jetpack,

I tested a minimum setup with your spec file and can confirm, that I am able compile a working apk. I am starting the long way to figure out, why my spec is not working.

Thnaks!

Carsten Thielepape

unread,
Apr 16, 2015, 6:12:30 AM4/16/15
to kivy-...@googlegroups.com
Got it (took some time to figure it out).

It's likely a bug in buildozer or python-for-android:
  • Creating a simple akp works with android default settings.
  • Creating a simple akp works with android.private_storage = False
  • Creating an akp which uses libs the python standard library (eg. from xml.etree              import ElementInclude) with android default settings works.
  • Creating an akp which uses libs the python standard library (eg. from xml.etree              import ElementInclude) with android.private_storage = True works not.
Looks like either the path to the lib is not ok, or it is not compiled properly. My build logs are alread attached in the previous logs!

Kivy Log file below:

INFO              ] Logger: Record log in /mnt/sdcard/org.orca.orca/.kivy/logs/kivy_15-04-16_1.txt
[INFO              ] Kivy: v1.9.0
[INFO              ] Python: v2.7.2 (default, Apr 16 2015, 10:58:27)
[GCC 4.8]
[INFO              ] Factory: 173 symbols loaded
[WARNING           ] stderr: /data/data/org.orca.orca/files/lib/python2.7/site-packages/kivy/core/image/img_pygame.py:13: RuntimeWarning: import cdrom: No module named cdrom
[WARNING           ] stderr: (ImportError: No module named cdrom)
[INFO              ] Image: Providers: img_tex, img_dds, img_gif, img_pygame, img_pil (img_ffpyplayer ignored)
[WARNING           ] stderr: Traceback (most recent call last):
[WARNING           ] stderr:   File "/home/kivy/workbd/.buildozer/android/app/main.py", line 37, in <module>
[WARNING           ] stderr:   File "/home/kivy/workbd/.buildozer/android/app/ORCA/App.py", line 31, in <module>
[WARNING           ] stderr:   File "/home/kivy/workbd/.buildozer/android/app/ORCA/InterfaceClass.py", line 38, in <module>
[WARNING           ] stderr:   File "/home/kivy/workbd/.buildozer/android/app/ORCA/Events.py", line 28, in <module>
[WARNING           ] stderr:   File "/home/kivy/workbd/.buildozer/android/app/ORCA/utils/XML.py", line 25, in <module>
[WARNING           ] stderr:   File "/home/kivy/workbd/.buildozer/android/app/ORCA/utils/XML.py", line 25, in <module>
[WARNING           ] stderr: ImportError: No module named etree



Am Samstag, 21. März 2015 11:32:43 UTC+1 schrieb Richard Jones:

qua non

unread,
Apr 16, 2015, 6:18:25 PM4/16/15
to kivy-...@googlegroups.com
Hey Carsten,

Nice job on narrowing it down.


--
Reply all
Reply to author
Forward
0 new messages