Python PyGame to Android App: How to make .apk and .aab files with Buildozer Full Tutorial
ฝัง
- เผยแพร่เมื่อ 13 ก.ย. 2024
- A tutorial about the process of turning a PyGame Game into an Android App using Buildozer in a virtual machine
Install buildozer: buildozer.read...
Signing .aab: / build-aab-file-and-sig...
Code for the sample project:
#################################################
import pygame, random, os
PATH = os.path.abspath('.')+'/'
pygame.init()
screen = pygame.display.set_mode((400, 400))
pygame_head = pygame.image.load(PATH+'pygame-head-party.png').convert_alpha()
current_color = (255, 0, 0)
done = False
while not done:
for event in pygame.event.get():
if event.type == pygame.QUIT: done = True
elif event.type == pygame.MOUSEBUTTONDOWN:
current_color = random.sample(range(0, 256), 3)
screen.fill(current_color)
screen.blit(pygame_head, (0,0))
pygame.display.flip()
pygame.quit()
###############################################
My games on the Play store: play.google.co...
My games on itch: finfetchannel....
My website: finfetchannel....
My discord: / discord
My GitHub: github.com/Fin...
I've seen the web version and it's great, thanks a lot, I was looking for something like this for a long time. I just need to watch carefully your tutorial.
It is a bit complex, but it's way easier than what I thought it would be!
Hello how to add vb gas disc please it's an emergency @@FinFET
nice video, man.. just had a little problem with your accent, whatever, thanks for making this video..
lol, subtitles are available 😅
bro the video was fast as lighning HOW AM I SUPPOSED TO SEE IT?!
keep up the good work man, this tutorial has helped me alot, i am now uploading version 0.2 of my app. thanks you!
vi que era brasileiro pelo sotaque, valeu meu rei
The best video i have ever seen . I am sooooo much thankful for this information ❤❤❤❤❤❤❤❤❤❤❤
can you tell me which versions of packages you're using to build this?
TY for clear instruction, dude!
Can I use other libraries inside that APK? Like _requests_ for API calls? Also I'd neet to open a webview for Ads.
How about to show how to make in-app purchases for Google Play in Kivy or PyGame code ?
Lol, since in-app purchases is an API for Java or Kotlin as well, it is impossible to call the API functions from pygame, you could create a way to communicate between Java and python to call the functions you wanna call then you would be done
Nice description, easy to follow and to the point. Thanks a lot, great work!
I am getting an error when running buildozer -v android debug, I get this error sdl2/sdl2.c:211:12: fatal error: 'longintrepr.h' file not found
#include "longintrepr.h"
Any ideas?
I have the same problem. Did you find a solution?
same error
same
Same problem. Something changed in a recent update.
for me it fixet it by define the pygame version: pygame==2.5.2 but the apk dont work and only use android.archs = arm64-v8a
hey man! remember me? Mudei para python e estou aprendendo um pouco de C :) yup learning portughese!
Opa, que legal cara! pode até assistir os vídeos do meu canal em portugues heheh
That's my little buddy... 🤔😏
this doesnt seem to work for me. followed steps with sudo, without sudo, buildozer fails to download (at random 80-99.9%) necessary android packages complaining about urllib and downloaded file sizes smaller than expected. if i manually dl android packages it works until it starts to download hostpython and hangs there as well complaining about downloaded file size smaller than etc etc..urllib error again. im not sure how to proceed. btw, i did this on win10, virtualbox, etc. also same errors with windows powershell ubuntu emulation. dl always hangs and scripts seem to give up after a few tries. no problems downloading anything else, big or small. also, pip, pip3 works, never hangs. just buildozer scripts. halp.
there is an Android related channel on Pygame's Discord, people there could help better, not sure what the problem is, sometimes when I find weird errors I delete all buildozer related files and start over, but sometimes it is something silly like a special character in a filename or folder or something like that discord.com/channels/772505616680878080/889466401004339210
I've been trying this exactly as you've mentioned in this video, but the terminal will always throw an error saying that this is an externally-managed-environment.
However, you're not getting that error yourself, so I cannot see why I'm encountering the error.
I guess is related to pip, maybe someone on the discord channel can help you discord.com/channels/772505616680878080/889466401004339210
Does this still works in 2024 September?
Haven't tried it for a while but I think it should still work fine
THANKS BRO!!!
👍👍👍👍👍👍👍👍👍👍👍
Hey, do you think the fps are better than on web?
Its a bit better than running the web version on a mobile browser
Olá tudo bem goste muito dos seus vídeos
mas tenho é esso quando faço Buildozer dá esse erro o que pode vir ser e esse erro da no final # Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2
Dificil dizer, teria que ver o restante do log, tem um canal no Discord do Pygame relacionado ao android, pessoal lá pode ajudar tbm discord.com/channels/772505616680878080/889466401004339210
Hello i have apk ineed to convert to aab can help me
do you have the source? is it python? if not, then I don't know how =/
Hey dude ! I tried turning a pool game in py to apk. Even though it was succesful, but when I opened the app, it didn't run and crashed immediately, I don't know what's wrong, is it because the window of the game is too big ? I checked the images and they are fine. Please help me, thank you so much !
I know my problem, when I wrote pymunk to buildozer.spec file and then convert to apk, there was an error, how do I fix it ?
@@nhatsanchau1613 try adding logcat grep python to the end of the buildozer command to see the error msgs
@@FinFET Hi I still couldn't fix the error, can you tell me how to add pymunk to the buildozer.spect. Thank you
can we run buildozer in google colab?
Would that work?
This could be a great way, I didn't try, but I found this colab.research.google.com/drive/1Rc8HJn8iWl1qGAj-k7crKe10Aq9pgwgn?usp=sharing
@@FinFET Thanks Buddy
@@codewithatharv5210is that work?
@@pmtcreative4090 I didn't understand what you are trying to say
where to get the iso file for the lubuntu in the video
cdimage.ubuntu.com/lubuntu/releases/20.04/release/
@@FinFET thanks really much,you are nice guy, thank you
Hi thanks for the video. I am having trouble with android permissions like INTERNET and READ_EXTERNAL_STORAGE, WRITE_EXTERNAL_STORAGE. Even though I have included them in my buildozer spec file my app can't connect to Internet and save files to SD card. Could you please help?
enable debug mode
That's HElpful:)))
Great, useful video! By the way, I'm not sure if you are interested but I sent you an email to your business contact.