I’m trying to build my first android app. I installed Kivy, buildozer and coded “hello world” as here. Then, I input “buildozer android debug” and it threw an error, “bla bla bla sdk directory is not specified” in this command:
/usr/bin/python3 -m pythonforandroid.toolchain create --dist_name=test2 --bootstrap=sdl2 --requirements=python3,kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir="/home/whiteblackgoose/PycharmProjects/mobileapp/test2/.buildozer/android/platform/build" --ndk-api=21
So I added some arguments to the command and made it work:
/usr/bin/python3 -m pythonforandroid.toolchain create --dist_name=test2 --bootstrap=sdl2 --requirements=python3,kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir="/home/whiteblackgoose/PycharmProjects/mobileapp/test2/.buildozer/android/platform/build" --ndk-api=21 --sdk-dir=/home/whiteblackgoose/.buildozer/android/platform/android-sdk --ndk-dir=/home/whiteblackgoose/.buildozer/android/platform/android-ndk-r17c
So when I’m trying to run it, it threw a new error:
File "/home/whiteblackgoose/PycharmProjects/mobileapp/test2/.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:
I reinstalled cython and tried to import ctypes and _ctypes:
whiteblackgoose@whiteblackgoose-VirtualBox:~/PycharmProjects/mobileapp/test2$ python3 Python 3.6.8 (default, Jan 14 2019, 11:02:34) [GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import ctypes >>> import _ctypes >>>
As you can see, when I import them there’s no problem. But if I run the command above, it says, “ModuleNotFoundError: No module named ‘_ctypes'”.
How do I make visible this module for buildozer? Or mb the problem is caused by an installed package or incorrect version of something…
Advertisement
Answer
You need to install the libffi headers. These come from the libffi-dev
package on Ubuntu, and usually something similar in other distros.
After that, clean the build by deleting the .buildozer
directory in your app dir and building again.