Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Export a Python script to an Android executable (.apk) with Python-For-Android

i'm trying to export my Python script to an Android executable (.apk) with Python for Android.

http://python-for-android.readthedocs.org/en/latest/toolchain/#how-does-it-work

https://github.com/kivy/python-for-android/

Inside the distribution (dist/default by default), you have a tool named build.py. This is the script that will create the APK for you

I have followed all the steps, but I have a problem : the dist/default folder created doesn't contain any build.py. It's empty.

What's the problem ? How do I resolve it ? Help, please !

like image 530
user3576902 Avatar asked Apr 26 '14 20:04

user3576902


1 Answers

So, basically, you're using buildozer and it's working now. Look in the buildozer.spec file again. There should be the lines:

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

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

what you want to do, I believe( because I had to do this ), is change them to this:

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

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

see I have commented out two lines at the top, and uncommented the bottom line. (I haven't bothered changing the '1.2.0' yet myself, so don't know if that makes a difference. It shouldn't.) The problem seems to be that buildozer looks for a line in your py file, __version__ = something, and there is an error when it doesn't find it. I tried adding this line to my python, but it still didn't work. This change however, did work.

Also, try running your build with verbose on, so you can see exactly what's causing any errors, for example:

sudo buildozer --verbose android debug deploy run
like image 181
Totem Avatar answered Nov 07 '22 11:11

Totem