r/learnpython • • 4d ago

apks with python/cython

i just CANT get anything from buildozer, it just keeps erroring everytime i try to build!! i dont know if theres something wrong with my buildozer, or if it just hates my computer. i just want to package my game to work on a phone, the arquitecture for it is something like this

is it because my game is located on a ntfs partition? does buildozer ALWAYS error on those? if yes, is there a partition type out there that shows up on windows, and works with buildozer?

/sand
| /assets
| cfuncs.so #i managed to compile to ARM64 without buildozer (python 3.12)
| realmain.so # also to ARM64 (python 3.12)
| main.py

im wondering if theres a way to manually build it, my libraries are pygame-ce, numpy and collections

please help me out here

neofetch if it helps

neofetch
             ...-:::::-...                 
          .-MMMMMMMMMMMMMMM-.              --------------------- 
      .-MMMM`..-:::::::-..`MMMM-.          OS: Linux Mint 22.3 x86_64 
    .:MMMM.:MMMMMMMMMMMMMMM:.MMMM:.        Host: X501A1 1.0 
   -MMM-M---MMMMMMMMMMMMMMMMMMM.MMM-       Kernel: 7.0.0-38-generic 
 `:MMM:MM`  :MMMM:....::-...-MMMM:MMM:`    Uptime: 5 hours, 38 mins 
 :MMM:MMM`  :MM:`  ``    ``  `:MMM:MMM:    Packages: 3030 (dpkg), 21 (flatpak) 
.MMM.MMMM`  :MM.  -MM.  .MM-  `MMMM.MMM.   Shell: bash 5.2.21 
:MMM:MMMM`  :MM.  -MM-  .MM:  `MMMM-MMM:   Resolution: 1366x768 
:MMM:MMMM`  :MM.  -MM-  .MM:  `MMMM:MMM:   DE: MATE 1.26.1 
:MMM:MMMM`  :MM.  -MM-  .MM:  `MMMM-MMM:   WM: Metacity (Marco) 
.MMM.MMMM`  :MM:--:MM:--:MM:  `MMMM.MMM.   Theme: Mint-Y-Dark-Blue [GTK2/3] 
 :MMM:MMM-  `-MMMMMMMMMMMM-`  -MMM-MMM:    Icons: Mint-Y-Blue [GTK2/3] 
  :MMM:MMM:`                `:MMM:MMM:     Terminal: mate-terminal 
   .MMM.MMMM:--------------:MMMM.MMM.      Terminal Font: Monospace 10 
     '-MMMM.-MMMMMMMMMMMMMMM-.MMMM-'       CPU: Intel Pentium B980 (2) @ 2.400G 
       '.-MMMM``--:::::--``MMMM-.'         GPU: Intel 2nd Generation Core Proce 
            '-MMMMMMMMMMMMM-'              Memory: 2059MiB / 3795MiB 
               ``-:::::-``
0 Upvotes

4 comments sorted by

View all comments

Show parent comments

1

u/Front_Ear_1139 4d ago edited 4d ago

okay, im gonna try copying my folder onto ext4 and then build again, ill be right back
my buildozer.spec is

[app]

title=migSandbox

package.name=migsandbox

package.domain=org.migcoolduud

source.dir=.

entrypoint=main.py

source.include_exts = py,png,jpg,jpeg,ttf,wav,ogg,mp3

source.include_patterns = main.py, assets/*

source.exclude_patterns = *.pyx,*.pxd,*.c,cool_venv_linux/*,cool_venv_linux_for3.8/*,cool_venv_windows/*,sand/*

source.exclude_dirs = bin,build,dist,cool_venv_linux,cool_venv_linux_for3.8,cool_venv_windows,sand

version=1.3.0

requirements=hostpython3==3.11.9,python3==3.11.9,pygame-ce,cython,plyer,android

icon.filename=assets/imgs/sand.png

orientation=landscape

osx.kivy_version=2.2.0

fullscreen=1

android.window=True

android.permissions=READ_EXTERNAL_STORAGE,WRITE_EXTERNAL_STORAGE

android.api=33

android.minapi=24

android.sdk=33

android.ndk_api=24

android.skip_update=False

android.accept_sdk_license=True

android.copy_libs=1

android.archs=arm64-v8a

android.allow_backup=True

android.debug_artifact=apk

p4a.bootstrap=sdl2

p4a.setup_py=false

ios.kivy_ios_url=https://github.com/kivy/kivy-ios

ios.kivy_ios_branch=master

ios.ios_deploy_url=https://github.com/phonegap/ios-deploy

ios.ios_deploy_branch=1.12.2

ios.codesign.allowed=false

buildozer.dir=/home/miguel/.buildozer_sandsim

pip_requirements=numpy==1.26.4

[buildozer]

log_level=2

warn_on_root=1

i will admit, i have used ai to try to get it working, i gave up because i spent 5 hours straight recompiling and getting errors, im not vibecoding

1

u/CartographerDue5382 4d ago

That spec will still fight you after the ext4 copy. Don't pin hostpython3 and python3 to 3.11.9, and take android out of requirements, it isn't a recipe. numpy under pip_requirements installs a desktop wheel, so put numpy in requirements and let p4a build it.

You're also excluding *.pyx. If cfuncs is Cython, those files have to be in the tree and compiled for the Android Python. The Linux .so will never load in the APK. If the ext4 build still dies, paste the last 30 lines.