I have created a basic docker image, been running in the shell, just to get a bare metal APK going. The only thing I've changed in the buildozer.spec is my python requirements:
requirements = python3,kivy,future,decorator
Essentially, I can successfully build if i take out the decorator requirement. This also happens with enum34. Many other requirements work successfully, such as python-dateutil, msgpack, monotonic. The last line of the stacktrace suggests there is an issue finding _ctypes in setuptools...
Command:
buildozer android debug
<snip>
...
STDOUT:
Traceback (most recent call last):
File "setup.py", line 11, in <module>
import setuptools
File "/kivytools/.buildozer/android/platform/build/build/other_builds/setuptools-python3/armeabi-v7a__ndk_target_21/setuptools/setuptools/__init__.py", line 14, in <module>
from setuptools.dist import Distribution, Feature
File "/kivytools/.buildozer/android/platform/build/build/other_builds/setuptools-python3/armeabi-v7a__ndk_target_21/setuptools/setuptools/dist.py", line 25, in <module>
from setuptools import windows_support
File "/kivytools/.buildozer/android/platform/build/build/other_builds/setuptools-python3/armeabi-v7a__ndk_target_21/setuptools/setuptools/windows_support.py", line 2, in <module>
import ctypes
File "/kivytools/.buildozer/android/platform/build/build/other_builds/hostpython3/desktop/hostpython3/Lib/ctypes/__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'
Spec file: (the exact thing generated by buildozer init, except for the additional requirements)
[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) List of inclusions using pattern matching
#source.include_patterns = assets/*,images/*.png
# (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 = 0.1
# (str) Application versioning (method 2)
# version.regex = __version__ = ['"](.*)['"]
# version.filename = %(source.dir)s/main.py
vim build
# (list) Application requirements
# comma separated e.g. requirements = sqlite3,kivy,decorator
# (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, 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.10.1
#
# Android specific
#
# (bool) Indicate if the application should be fullscreen or not
fullscreen = 0
# (string) Presplash background color (for new android toolchain)
# Supported formats are: #RRGGBB #AARRGGBB or one of the following names:
# red, blue, green, black, white, gray, cyan, magenta, yellow, lightgray,
# darkgray, grey, lightgrey, darkgrey, aqua, fuchsia, lime, maroon, navy,
# olive, purple, silver, teal.
#android.presplash_color = #FFFFFF
# (list) Permissions
#android.permissions = INTERNET
# (int) Android API to use
android.api = 26
# (int) Minimum API required
#android.minapi = 9
# (int) Android SDK version to use
#android.sdk = 20
# (str) Android NDK version to use
#android.ndk = r19-darwin-x86_64
# (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 = /ndks/android-ndk-r18b
# (str) Android SDK directory (if empty, it will be automatically downloaded.)
#android.sdk_path =
# (str) ANT directory (if empty, it will be automatically downloaded.)
#android.ant_path =
# (bool) If True, then skip trying to update the Android sdk
# This can be useful to avoid excess Internet downloads or save time
# when an update is due and you just want to test/build your package
# android.skip_update = False
# (str) Android entry point, default is ok for Kivy-based app
#android.entrypoint = org.renpy.android.PythonActivity
# (list) Pattern to whitelist for the whole project
#android.whitelist =
# (str) Path to a custom whitelist file
#android.whitelist_src =
# (str) Path to a custom blacklist file
#android.blacklist_src =
# (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 =
# (list) Android AAR archives to add (currently works only with sdl2_gradle
# bootstrap)
#android.add_aars =
# (list) Gradle dependencies to add (currently works only with sdl2_gradle
# bootstrap)
#android.gradle_dependencies =
# (list) Java classes to add as activities to the manifest.
#android.add_activites = com.example.ExampleActivity
# (str) python-for-android branch to use, defaults to stable
p4a.branch = stable
# (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 =
# (str) launchMode to set for the main activity
#android.manifest.launch_mode = standard
# (list) Android additional 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 =
# (str) Android logcat filters to use
#android.logcat_filters = *:S python:D
# (bool) Copy library instead of making a libpymodules.so
#android.copy_libs = 1
# (str) The Android arch to build for, choices: armeabi-v7a, arm64-v8a, x86
android.arch = armeabi-v7a
#
# Python for android (p4a) specific
#
# (str) python-for-android git clone directory (if empty, it will be automatically cloned from github)
#p4a.source_dir =
# (str) The directory in which python-for-android should look for your own build recipes (if any)
#p4a.local_recipes =
# (str) Filename to the hook for p4a
#p4a.hook =
# (str) Bootstrap to use for android builds
# p4a.bootstrap = sdl2
# (int) port number to specify an explicit --port= p4a argument (eg for bootstrap flask)
#p4a.port =
#
# iOS specific
#
# (str) Path to a custom kivy-ios folder
#ios.kivy_ios_dir = ../kivy-ios
# (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
# (str) Path to build artifact storage, absolute or relative to spec file
# build_dir = ./.buildozer
# (str) Path to build output (i.e. .apk, .ipa) storage
# bin_dir = ./bin
# -----------------------------------------------------------------------------
# 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
[INFO]: Building setuptools for armeabi-v7a
[INFO]: setuptools apparently isn't already in site-packages
[INFO]: Installing setuptools into site-packages
[INFO]: -> directory context /kivytools/.buildozer/android/platform/build/build/other_builds/setuptools-python3/armeabi-v7a__ndk_target_21/setuptools
[INFO]: -> running python setup.py install -O2 --root=/kivytools/.buildozer/android/platform/build/build/python-installs/myapp --install-lib=.
working: File "/kivytools/.buildozer/android/platform/build/build/other_builds/setuptools-python3/armeabi-v7a__ndk_target_21/setuptools/setException in thread background thread for pid 78291:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/usr/local/lib/python2.7/dist-packages/sh.py", line 1540, in wrap
fn(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/sh.py", line 2459, in background_thread
handle_exit_code(exit_code)
File "/usr/local/lib/python2.7/dist-packages/sh.py", line 2157, in fn
return self.command.handle_command_exit_code(exit_code)
File "/usr/local/lib/python2.7/dist-packages/sh.py", line 815, in handle_command_exit_code
raise exc
ErrorReturnCode_1:
RAN: /kivytools/.buildozer/android/platform/build/build/other_builds/hostpython3/desktop/hostpython3/native-build/python setup.py install -O2 --root=/kivytools/.buildozer/android/platform/build/build/python-installs/myapp --install-lib=.
STDOUT:
Traceback (most recent call last):
File "setup.py", line 11, in <module>
import setuptools
File "/kivytools/.buildozer/android/platform/build/build/other_builds/setuptools-python3/armeabi-v7a__ndk_target_21/setuptools/setuptools/__init__.py", line 14, in <module>
from setuptools.dist import Distribution, Feature
File "/kivytools/.buildozer/android/platform/build/build/other_builds/setuptools-python3/armeabi-v7a__ndk_target_21/setuptools/setuptools/dist.py", line 25, in <module>
from setuptools import windows_support
File "/kivytools/.buildozer/android/platform/build/build/other_builds/setuptools-python3/armeabi-v7a__ndk_target_21/setuptools/setuptools/windows_support.py", line 2, in <module>
import ctypes
File "/kivytools/.buildozer/android/platform/build/build/other_builds/hostpython3/desktop/hostpython3/Lib/ctypes/__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'
STDERR:
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/kivytools/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1057, in <module>
main()
File "/kivytools/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1051, in main
ToolchainCL()
File "/kivytools/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 560, in __init__
getattr(self, args.subparser_name.replace('-', '_'))(args)
File "/kivytools/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 151, in wrapper_func
build_dist_from_args(ctx, dist, args)
File "/kivytools/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 192, in build_dist_from_args
build_recipes(build_order, python_modules, ctx)
File "pythonforandroid/build.py", line 565, in build_recipes
File "pythonforandroid/recipe.py", line 824, in build_arch
File "pythonforandroid/recipe.py", line 845, in install_python_package
File "pythonforandroid/logger.py", line 178, in shprint
File "/usr/local/lib/python2.7/dist-packages/sh.py", line 863, in next
self.wait()
File "/usr/local/lib/python2.7/dist-packages/sh.py", line 792, in wait
self.handle_command_exit_code(exit_code)
File "/usr/local/lib/python2.7/dist-packages/sh.py", line 815, in handle_command_exit_code
raise exc
sh.ErrorReturnCode_1:
RAN: /kivytools/.buildozer/android/platform/build/build/other_builds/hostpython3/desktop/hostpython3/native-build/python setup.py install -O2 --root=/kivytools/.buildozer/android/platform/build/build/python-installs/myapp --install-lib=.
STDOUT:
Traceback (most recent call last):
File "setup.py", line 11, in <module>
import setuptools
File "/kivytools/.buildozer/android/platform/build/build/other_builds/setuptools-python3/armeabi-v7a__ndk_target_21/setuptools/setuptools/__init__.py", line 14, in <module>
from setuptools.dist import Distribution, Feature
File "/kivytools/.buildozer/android/platform/build/build/other_builds/setuptools-python3/armeabi-v7a__ndk_target_21/setuptools/setuptools/dist.py", line 25, in <module>
from setuptools import windows_support
File "/kivytools/.buildozer/android/platform/build/build/other_builds/setuptools-python3/armeabi-v7a__ndk_target_21/setuptools/setuptools/windows_support.py", line 2, in <module>
import ctypes
File "/kivytools/.buildozer/android/platform/build/build/other_builds/hostpython3/desktop/hostpython3/Lib/ctypes/__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'
# Command failed: /usr/bin/python -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=python3,kivy,future,decorator --arch armeabi-v7a --copy-libs --color=always --storage-dir="/kivytools/.buildozer/android/platform/build" --ndk-api=21
I found a few other modifications that were suggested, but unfortunately it didn't resolve
(1) Add libffi to the requirements
(2) Install apt-get install autogen autoconf libtool
That gets libffi to be actually built, but it's not succeeding:
Makefile:1176: recipe for target 'libffi.la' failed
make: *** [libffi.la] Error 1
Add libffi to you requeriments, the python3 recipe needs that library to successfully build the python's _ctypes module:
requirements = libffi,python3,kivy,future,decorator
@mattrunchey, please, check if that works for you and close this issue if that is the case :wink:
Almost! Seems to be an error that prevents libffi building - https://stackoverflow.com/questions/6881164/crtbegin-so-o-missing-for-android-toolchain-custom-build ... trying a couple of things real quick.
libtool: link: /usr/bin/ccache arm-linux-androideabi-gcc -DANDROID -fomit-frame-pointer -D__ANDROID_API__=21 -mandroid -isystem /root/.buildozer/android/platform/android-ndk-r17c/sysroot/usr/include/arm-linux-androideabi -I/root/.buildozer/android/platform/android-ndk-r17c/sysroot/usr/include/arm-linux-androideabi -isysroot /root/.buildozer/android/platform/android-ndk-r17c/sysroot -I/kivytools/.buildozer/android/platform/build/build/python-installs/myapp/include/python3.7 -shared -fPIC -DPIC src/.libs/prep_cif.o src/.libs/types.o src/.libs/raw_api.o src/.libs/java_raw_api.o src/.libs/closures.o src/arm/.libs/sysv.o src/arm/.libs/ffi.o -L/kivytools/.buildozer/android/platform/build/build/libs_collections/myapp/armeabi-v7a -lm -mandroid -isysroot /root/.buildozer/android/platform/android-ndk-r17c/sysroot -mandroid -isysroot /root/.buildozer/android/platform/android-ndk-r17c/sysroot -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb --sysroot --sysroot /root/.buildozer/android/platform/android-ndk-r17c/platforms/android-21/arch-arm -Wl,-soname -Wl,libffi.so -o .libs/libffi.so
/root/.buildozer/android/platform/android-ndk-r17c/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot open crtbegin_so.o: No such file or directory
Which is weird, since the "hacky stuff for linking" copies those files...
[WARNING]: Doing some hacky stuff to link properly
[INFO]: -> running cp /root/.buildozer/android/platform/android-ndk-r17c/platforms/android-21/arch-arm/usr/lib/crtbegin_so.o ./
[INFO]: -> running cp /root/.buildozer/android/platform/android-ndk-r17c/platforms/android-21/arch-arm/usr/lib/crtend_so.o ./
I'm going to try it with another android-ndk, but am not hopeful. I can't quite manually try the rebuild within buildozer, but I'm going to see if I can't compile it manually and rule out an ubuntu 18.04 issue.
Yea, I'm unable to build libffi on both ubuntu 16.04 and ubuntu 18.04 with a python3 target. Here's a series of setup commands that should enable you to repro it:
(use ubuntu:xenail or ubuntu:bionic)
docker run -it ubuntu:xenial /bin/bash
apt update -qq > /dev/null && apt install -qq --yes --no-install-recommends locales && locale-gen en_US.UTF-8
apt install -qq --yes --no-install-recommends sudo python-pip python-setuptools file
dpkg --add-architecture i386 && apt update -qq > /dev/null && apt install -qq --yes --no-install-recommends build-essential ccache git libncurses5:i386 libstdc++6:i386 libgtk2.0-0:i386 libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 python2.7 python2.7-dev openjdk-8-jdk unzip zlib1g-dev zlib1g:i386
apt-get install vim zip python3-venv autoconf autogen libtool wget
pip install https://github.com/kivy/buildozer/archive/master.zip
pip install cython
mkdir kivyfoo
cd kivyfoo
buildozer init
vim buildozer.spec
(add libffi and decorator to requirements line, change log_level to 2)
buildozer android debug
You'll see the debug fail to build libffi, and still fail when trying to use _ctypes for decorator.
Can you add libffi-dev into your apt-get install command and try it again please?
Yessir
Also, amended my above to include the pip installs for buildozer that I missed, in addition to the libffi-dev.
Thank you for the accurate help!! It seems to work now. Hopefully anyone else coming across this problem can use this issue as a way to resolve/path forward :)
Hi Team,
I'm encountering the same issue. Even though I followed the steps provided.
# (list) Application requirements
# comma separated e.g. requirements = sqlite3,kivy
requirements = libffi-dev,python3,kivy,sqlalchemy
# (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes
# requirements.source.kivy = ../../kivy
myasul@ubuntu:~/Documents/personal_projects/ekt_dictionary$ sudo apt-get install libffi-dev
[sudo] password for myasul:
Sorry, try again.
[sudo] password for myasul:
Reading package lists... Done
Building dependency tree
Reading state information... Done
libffi-dev is already the newest version (3.2.1-8).
The following package was automatically installed and is no longer required:
python3-gst-1.0
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
[INFO]: Building setuptools for armeabi-v7a
[INFO]: setuptools apparently isn't already in site-packages
[INFO]: Installing setuptools into site-packages
[INFO]: -> directory context /home/myasul/Documents/personal_projects/ekt_dictionary/.buildozer/android/platform/build/build/other_builds/setuptools-python3/armeabi-v7a__ndk_target_21/setuptools
[INFO]: -> running python setup.py install -O2 --root=/home/myasul/Documents/personal_projects/ekt_dictionary/.buildozer/android/platform/build/bu...(and 50 more)
Exception in thread background thread for pid 81174:
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/home/myasul/.local/lib/python3.6/site-packages/sh.py", line 1540, in wrap
fn(*args, **kwargs)
File "/home/myasul/.local/lib/python3.6/site-packages/sh.py", line 2459, in background_thread
handle_exit_code(exit_code)
File "/home/myasul/.local/lib/python3.6/site-packages/sh.py", line 2157, in fn
return self.command.handle_command_exit_code(exit_code)
File "/home/myasul/.local/lib/python3.6/site-packages/sh.py", line 815, in handle_command_exit_code
raise exc
sh.ErrorReturnCode_1:
RAN: /home/myasul/Documents/personal_projects/ekt_dictionary/.buildozer/android/platform/build/build/other_builds/hostpython3/desktop/hostpython3/native-build/python setup.py install -O2 --root=/home/myasul/Documents/personal_projects/ekt_dictionary/.buildozer/android/platform/build/build/python-installs/ekt_dictionary --install-lib=.
STDOUT:
Traceback (most recent call last):
File "setup.py", line 11, in <module>
import setuptools
File "/home/myasul/Documents/personal_projects/ekt_dictionary/.buildozer/android/platform/build/build/other_builds/setuptools-python3/armeabi-v7a__ndk_target_21/setuptools/setuptools/__init__.py", line 14, in <module>
from setuptools.dist import Distribution, Feature
File "/home/myasul/Documents/personal_projects/ekt_dictionary/.buildozer/android/platform/build/build/other_builds/setuptools-python3/armeabi-v7a__ndk_target_21/setuptools/setuptools/dist.py", line 25, in <module>
from setuptools import windows_support
File "/home/myasul/Documents/personal_projects/ekt_dictionary/.buildozer/android/platform/build/build/other_builds/setuptools-python3/armeabi-v7a__ndk_target_21/setuptools/setuptools/windows_support.py", line 2, in <module>
import ctypes
File "/home/myasul/Documents/personal_projects/ekt_dictionary/.buildozer/android/platform/build/build/other_builds/hostpython3/desktop/hostpython3/Lib/ctypes/__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'
STDERR:
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/myasul/Documents/personal_projects/ekt_dictionary/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1081, in <module>
main()
File "/home/myasul/Documents/personal_projects/ekt_dictionary/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1075, in main
ToolchainCL()
File "/home/myasul/Documents/personal_projects/ekt_dictionary/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 577, in __init__
getattr(self, args.subparser_name.replace('-', '_'))(args)
File "/home/myasul/Documents/personal_projects/ekt_dictionary/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 151, in wrapper_func
build_dist_from_args(ctx, dist, args)
File "/home/myasul/Documents/personal_projects/ekt_dictionary/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 200, in build_dist_from_args
build_recipes(build_order, python_modules, ctx)
File "/home/myasul/Documents/personal_projects/ekt_dictionary/.buildozer/android/platform/python-for-android/pythonforandroid/build.py", line 562, in build_recipes
recipe.build_arch(arch)
File "/home/myasul/Documents/personal_projects/ekt_dictionary/.buildozer/android/platform/python-for-android/pythonforandroid/recipe.py", line 834, in build_arch
self.install_python_package(arch)
File "/home/myasul/Documents/personal_projects/ekt_dictionary/.buildozer/android/platform/python-for-android/pythonforandroid/recipe.py", line 855, in install_python_package
_env=hpenv, *self.setup_extra_args)
File "/home/myasul/Documents/personal_projects/ekt_dictionary/.buildozer/android/platform/python-for-android/pythonforandroid/logger.py", line 178, in shprint
for line in output:
File "/home/myasul/.local/lib/python3.6/site-packages/sh.py", line 863, in next
self.wait()
File "/home/myasul/.local/lib/python3.6/site-packages/sh.py", line 792, in wait
self.handle_command_exit_code(exit_code)
File "/home/myasul/.local/lib/python3.6/site-packages/sh.py", line 815, in handle_command_exit_code
raise exc
sh.ErrorReturnCode_1:
RAN: /home/myasul/Documents/personal_projects/ekt_dictionary/.buildozer/android/platform/build/build/other_builds/hostpython3/desktop/hostpython3/native-build/python setup.py install -O2 --root=/home/myasul/Documents/personal_projects/ekt_dictionary/.buildozer/android/platform/build/build/python-installs/ekt_dictionary --install-lib=.
STDOUT:
Traceback (most recent call last):
File "setup.py", line 11, in <module>
import setuptools
File "/home/myasul/Documents/personal_projects/ekt_dictionary/.buildozer/android/platform/build/build/other_builds/setuptools-python3/armeabi-v7a__ndk_target_21/setuptools/setuptools/__init__.py", line 14, in <module>
from setuptools.dist import Distribution, Feature
File "/home/myasul/Documents/personal_projects/ekt_dictionary/.buildozer/android/platform/build/build/other_builds/setuptools-python3/armeabi-v7a__ndk_target_21/setuptools/setuptools/dist.py", line 25, in <module>
from setuptools import windows_support
File "/home/myasul/Documents/personal_projects/ekt_dictionary/.buildozer/android/platform/build/build/other_builds/setuptools-python3/armeabi-v7a__ndk_target_21/setuptools/setuptools/windows_support.py", line 2, in <module>
import ctypes
File "/home/myasul/Documents/personal_projects/ekt_dictionary/.buildozer/android/platform/build/build/other_builds/hostpython3/desktop/hostpython3/Lib/ctypes/__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'
Can you please advise what else I can try to resolve the issue? Should I open a new issue?
I have resolved the issue by deleting the .buildozer inside my projects folder then building again. I have a new error, I'll just raise a new issue. Thank you!
I had the same issue until i cleaned buildozer by this command
buildozer android clean
then renamed the .py file to main.py
check this https://stackoverflow.com/questions/54621830/errors-packaging-app-for-android-using-ubuntu-and-buildozer
make sure that libffi in requirments not libffi-dev
please tell if this solved the problem
Can you add
libffi-devinto yourapt-get installcommand and try it again please?
Is this really resolved? Given that python-for-android downloads libffi as part of the build process, shouldn't it be able to use the libffi that it downloaded?
Most helpful comment
Yessir
Also, amended my above to include the pip installs for
buildozerthat I missed, in addition to thelibffi-dev.Thank you for the accurate help!! It seems to work now. Hopefully anyone else coming across this problem can use this issue as a way to resolve/path forward :)