8

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 !

4
  • If you're using linux, your should check out buildozer. It makes the whole process clean and easy: github.com/kivy/buildozer Commented Apr 26, 2014 at 20:56
  • I tried Buildozer, but when I used buildozer android debug I obtained # Command failed: ./distribute.sh -m "kivy" -d "myapp"... Could someone help me, please ? Commented Apr 26, 2014 at 22:13
  • perhaps have a look in the buildozer.spec file in your project folder and make sure that kivy isn't listed as a requirment(ex: requirements = kivy), if so comment out the line. If this doesn't work, I would ask a question in the kivy user support group. Despite the fact you are not using kivy, they seem to know a lot about buildozer there Commented Apr 27, 2014 at 12:46
  • So, Buildozer works correctly, I have reinstalled it. Now, when I try to compile my script, I obtain this error pastebin.com/VCLb4XtH . How do I resolve it ? Thanks for your help Commented Apr 27, 2014 at 18:37

1 Answer 1

2

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.