I’m building an app using kivy and it works perfectly on my Linux laptop. I build the app for android using buildozer and the log does not show any errors. When it was complete, the apk file is created in the bin folder.
I then copy the apk file and paste it on my phone storage and then install the app.
When I open the app, it shows the kivy logo and loading… but then it crashes! I tried the whole day to find a solution but I could not achieve that.
I find this command while googling the problem and it should be helpful for debugging but I can’t understand the output!:
buildozer android logcat
This is the log that gets printed when I run this command
# Ensure build layout
# Check configuration tokens
# Run 'dpkg --version'
# Cwd None
Debian 'dpkg' package management program version 1.19.0.5 (amd64).
This is free software; see the GNU General Public License version 2 or
later for copying conditions. There is NO warranty.
# Search for Git (git)
# -> found at /usr/bin/git
# Search for Cython (cython)
# -> found at /home/nidhal/.local/bin/cython
# Search for Java compiler (javac)
# -> found at /usr/lib/jvm/java-11-openjdk-amd64/bin/javac
# Search for Java keytool (keytool)
# -> found at /usr/lib/jvm/java-11-openjdk-amd64/bin/keytool
# Run '/home/nidhal/.buildozer/android/platform/android-sdk/platform-tools/adb devices'
# Cwd None
List of devices attached
nidhal@nidhal-Latitude-E6320:~/Desktop/my_code/deep-translator-app$ clear
nidhal@nidhal-Latitude-E6320:~/Desktop/my_code/deep-translator-app$ buildozer android logcat
# Check configuration tokens
# Ensure build layout
# Check configuration tokens
# Run 'dpkg --version'
# Cwd None
Debian 'dpkg' package management program version 1.19.0.5 (amd64).
This is free software; see the GNU General Public License version 2 or
later for copying conditions. There is NO warranty.
# Search for Git (git)
# -> found at /usr/bin/git
# Search for Cython (cython)
# -> found at /home/nidhal/.local/bin/cython
# Search for Java compiler (javac)
# -> found at /usr/lib/jvm/java-11-openjdk-amd64/bin/javac
# Search for Java keytool (keytool)
# -> found at /usr/lib/jvm/java-11-openjdk-amd64/bin/keytool
# Run '/home/nidhal/.buildozer/android/platform/android-sdk/platform-tools/adb devices'
# Cwd None
List of devices attached
Furthermore, I tried to store the whole log when running the build using this command:
buildozer android debug deploy run logcat > log.txt
here is the log file
Moreover, here are the changes that I made to the default 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
#
EDIT
here is the output of the logcat
Edit2: After resolving the no module found error adressed by @inclement, the app still crashes on my android phone. Here is the new logcat i receive when i run the app
2
Answers
After days of debugging, I finally find the error, which is caused by some third party libraries that I used in my project. Obviously, kivy, buildozer or python-for-android could not parse this (I don't know how the packaging is done).
If anyone is having this problem, I highly recommend debugging with an emulator and not relying on the logcat. In my case the logcat was useless. It did not tell me nothing about the error.
I needed to try step by step removing dependencies until I found the error. Answer and comment of @inclement were also helpful.
Since the app is starting successfully, look in the logcat for lines containing the string "python". This will reveal the traceback:
Beautifulsoup4 needs a python-for-android build recipe to work, but I don’t think there currently is one (although your problem seems to be more generically that you didn’t include it at all).