how to use .so, .c, .o files in my android kivy project

36 Views Asked by At

I am building an android app using kivy and buildozer. After running my app it crashes. I saw its logs which says

File "/home/ali/Documents/Cryptography/.buildozer/android/app/main.py", line 366, in
File "/home/ali/Documents/Cryptography/.buildozer/android/app/main.py", line 379, in episode_menu_callback
File "", line 1, in
File "/home/ali/Documents/Cryptography/.buildozer/android/app/qpcrypto/kem/kyber1024.py", line 1, in
ModuleNotFoundError: No module named 'qpcrypto._kem.kyber1024'
Python for android ended.

the lines 378 and 379 of my main.py code is as follow

import_statement = f"from qpcrypto.kem.{text_item} import generate_keypair, encrypt, decrypt"
exec(import_statement)

in which text_item is 'kyber1024'.

in the first line of my kyber1024 i have "from .._kem.kyber1024 import ffi as __ffi, lib as __lib"

my directory structure is as follow

|-- main.py
|-- qpcrypto
|   |-- _kem
|   |   |-- kyber1024.c
|   |   |-- kyber1024.cpython-310-x86_64-linux-gnu.so
|   |   |-- kyber1024.o
|   |-- kem
|   |   |--kyber1024.py

not that in my _kem directory i don't have kyber1024.py.

when i run this app in my pc it works well, but after converting it to .apk file using buildozer i get the mentioned error.

in my .spec file i have

source.include_exts = py,png,jpg,kv,atlas,ttf,txt,json,pkl,mp4,mp3,so,c,h,o

in fact i want to use python pqcrypto in my kivy app. its installation is not as simple as it is discussed in https://github.com/kpdemetriou/pqcrypto/issues/10. so i have first installed it to my pc and now i am using the installed file (qpcrypto) in my kivy project.

0

There are 0 best solutions below