Reputation: 1277
This is really confusing when using buildozer to build Kivy apps for Android or iOS. The right way to put the dependencies and requirements in the buildozer spec file is not provided in the docs.
Now I built an app using the Kivy framework and I want to build an .apk file to deploy it on Android. I'm using buildozer for building the apk file since it is the recommended way as shown in the docs.
The app run perfectly on my laptop and the buildozer logs show no errors, in fact it gives me a success build at the end of the job. Unfortunately, the app crashes after deploying the apk file on my android phone and installing it. The UI is not shown at all, the app crashes directly after I click on the icon.
Since there are no log errors, I'm assuming this have something to do with how I'm building the app or more accurately the buildozer spec file. This is my buildozer spec file:
[app]
# (str) Title of your application
title = Overall Translator
# (str) Package name
package.name = overallTranslator
# (str) Package domain (needed for android/ios packaging)
package.domain = org.nidhal.overallTranslator
# (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,ttf
# (list) List of inclusions using pattern matching
source.include_patterns = assets/*,images/*.png, font/*.ttf
# (list) Source files to exclude (let empty to not exclude anything)
source.exclude_exts = spec, txt, md, gitignore
# (list) List of directory to exclude (let empty to not exclude anything)
source.exclude_dirs = tests, bin, venv
# (list) List of exclusions using pattern matching
#source.exclude_patterns = license,images/*/*.jpg
# (str) Application versioning (method 1)
#version = 0.1
# (str) Application versioning (method 2)
version.regex = __version__ = ['"](.*)['"]
version.filename = %(source.dir)s/main.py
# (list) Application requirements
# comma separated e.g. requirements = sqlite3,kivy
requirements = hostpython3==3.7.8,python3==3.7.8,kivy==1.11.1, beautifulsoup4, bs4, certifi,chardet,docutils, future, idna, Kivy-Garden, Pygments, requests, six, soupsieve, urllib3, deep-translator, arabic-reshaper, python-bidi, openssl
# (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes
# requirements.source.kivy = ../../kivy
# (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, sensorLandscape, portrait or all)
orientation = portrait
# (list) List of service to declare
#services = NAME:ENTRYPOINT_TO_PY,NAME2:ENTRYPOINT2_TO_PY
#
# OSX Specific
#
#
# author = © Copyright Info
# change the major version of python used by the app
osx.python_version = 3
# Kivy version to use
osx.kivy_version = 1.9.1
#
As any project, mine have also dependencies, where I should put in the requirements inside the spec file. This is confusing since there is no description how to do this the right way. For example I have libraries that works only on python >= 3.7, how I provide this in the requirements? Am I doing it the right way in the spec file above?
Furthermore, am I providing the version of each package the right way? I posted this question where I provided the log output of my build and debug mode when I open the app on my phone, but I did not receive any helpful information. That question contains logs.
Upvotes: 2
Views: 6823
Reputation: 29488
what is the correct way to put python version and requirements in buildozer spec file?
The direct answer to this is "the way you have done it" using the buildozer.spec line requirements = hostpython3==3.7.8,python3==3.7.8
. The only caveat is that not all minor python versions will necessarily work, I don't know if 3.7.8 is good. If possible it's better to let the defaults be used, in this case this will use Python 3.8 (but you'll need to clean the build and run again to make this happen). However, the main issues you'd have with a bad minor version would lead to failed compilation, so this probably isn't your problem.
Your question is clearly really getting at "why is my app crashing?". I suggest asking that question separately and including the full logcat output. This is likely to be more productive than guessing a cause and asking about that.
Upvotes: 3