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...

ความคิดเห็น • 55

  • @johnstarfire
    @johnstarfire ปีที่แล้ว +13

    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.

    • @FinFET
      @FinFET  ปีที่แล้ว

      It is a bit complex, but it's way easier than what I thought it would be!

    • @mdirfan_475
      @mdirfan_475 4 หลายเดือนก่อน

      Hello how to add vb gas disc please it's an emergency ​@@FinFET

  • @mac7xp
    @mac7xp หลายเดือนก่อน +4

    nice video, man.. just had a little problem with your accent, whatever, thanks for making this video..

    • @FinFET
      @FinFET  หลายเดือนก่อน +1

      lol, subtitles are available 😅

  • @thefatkid12
    @thefatkid12 3 หลายเดือนก่อน +2

    bro the video was fast as lighning HOW AM I SUPPOSED TO SEE IT?!

  • @teafd
    @teafd ปีที่แล้ว +3

    keep up the good work man, this tutorial has helped me alot, i am now uploading version 0.2 of my app. thanks you!

  • @victorhugo9839
    @victorhugo9839 11 วันที่ผ่านมา +2

    vi que era brasileiro pelo sotaque, valeu meu rei

  • @prashantrawat3096
    @prashantrawat3096 6 หลายเดือนก่อน

    The best video i have ever seen . I am sooooo much thankful for this information ❤❤❤❤❤❤❤❤❤❤❤

  • @slvgame
    @slvgame 3 หลายเดือนก่อน +2

    can you tell me which versions of packages you're using to build this?

  • @koss165
    @koss165 7 หลายเดือนก่อน

    TY for clear instruction, dude!

  • @christianremboldt1557
    @christianremboldt1557 5 หลายเดือนก่อน +1

    Can I use other libraries inside that APK? Like _requests_ for API calls? Also I'd neet to open a webview for Ads.

  • @IgorZyden
    @IgorZyden ปีที่แล้ว +6

    How about to show how to make in-app purchases for Google Play in Kivy or PyGame code ?

    • @x4vih338
      @x4vih338 7 หลายเดือนก่อน +1

      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

  • @suchaluch5615
    @suchaluch5615 6 หลายเดือนก่อน

    Nice description, easy to follow and to the point. Thanks a lot, great work!

  • @KoLoap817
    @KoLoap817 5 หลายเดือนก่อน +5

    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?

    • @dominik9516
      @dominik9516 5 หลายเดือนก่อน +3

      I have the same problem. Did you find a solution?

    • @ZubairAli-bb8ic
      @ZubairAli-bb8ic 5 หลายเดือนก่อน +4

      same error

    • @ghegogago8297
      @ghegogago8297 4 หลายเดือนก่อน +1

      same

    • @user_28943
      @user_28943 4 หลายเดือนก่อน

      Same problem. Something changed in a recent update.

    • @_Tigertatze_
      @_Tigertatze_ 3 หลายเดือนก่อน

      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

  • @aintNexus
    @aintNexus ปีที่แล้ว +2

    hey man! remember me? Mudei para python e estou aprendendo um pouco de C :) yup learning portughese!

    • @FinFET
      @FinFET  ปีที่แล้ว

      Opa, que legal cara! pode até assistir os vídeos do meu canal em portugues heheh

  • @SkyFly19853
    @SkyFly19853 ปีที่แล้ว +1

    That's my little buddy... 🤔😏

  • @CARBONTEAofficial
    @CARBONTEAofficial ปีที่แล้ว +1

    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.

    • @FinFET
      @FinFET  ปีที่แล้ว +1

      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

  • @superpepe826
    @superpepe826 หลายเดือนก่อน

    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.

    • @FinFET
      @FinFET  หลายเดือนก่อน

      I guess is related to pip, maybe someone on the discord channel can help you discord.com/channels/772505616680878080/889466401004339210

  • @jdp25
    @jdp25 11 วันที่ผ่านมา +1

    Does this still works in 2024 September?

    • @FinFET
      @FinFET  10 วันที่ผ่านมา

      Haven't tried it for a while but I think it should still work fine

  • @Codis000
    @Codis000 4 หลายเดือนก่อน

    THANKS BRO!!!
    👍👍👍👍👍👍👍👍👍👍👍

  • @edua1343
    @edua1343 ปีที่แล้ว +1

    Hey, do you think the fps are better than on web?

    • @FinFET
      @FinFET  ปีที่แล้ว

      Its a bit better than running the web version on a mobile browser

  • @Luis-Mussa
    @Luis-Mussa ปีที่แล้ว +1

    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

    • @FinFET
      @FinFET  ปีที่แล้ว

      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

  • @ahmedfitness5572
    @ahmedfitness5572 ปีที่แล้ว +1

    Hello i have apk ineed to convert to aab can help me

    • @FinFET
      @FinFET  ปีที่แล้ว

      do you have the source? is it python? if not, then I don't know how =/

  • @nhatsanchau1613
    @nhatsanchau1613 ปีที่แล้ว +1

    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 !

    • @nhatsanchau1613
      @nhatsanchau1613 ปีที่แล้ว

      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 ?

    • @FinFET
      @FinFET  ปีที่แล้ว

      @@nhatsanchau1613 try adding logcat grep python to the end of the buildozer command to see the error msgs

    • @nhatsanchau1613
      @nhatsanchau1613 ปีที่แล้ว

      @@FinFET Hi I still couldn't fix the error, can you tell me how to add pymunk to the buildozer.spect. Thank you

  • @codewithatharv5210
    @codewithatharv5210 ปีที่แล้ว +1

    can we run buildozer in google colab?
    Would that work?

    • @FinFET
      @FinFET  ปีที่แล้ว

      This could be a great way, I didn't try, but I found this colab.research.google.com/drive/1Rc8HJn8iWl1qGAj-k7crKe10Aq9pgwgn?usp=sharing

    • @codewithatharv5210
      @codewithatharv5210 ปีที่แล้ว +1

      @@FinFET Thanks Buddy

    • @pmtcreative4090
      @pmtcreative4090 ปีที่แล้ว

      ​@@codewithatharv5210is that work?

    • @codewithatharv5210
      @codewithatharv5210 ปีที่แล้ว

      @@pmtcreative4090 I didn't understand what you are trying to say

  • @LoongBerries
    @LoongBerries 6 หลายเดือนก่อน

    where to get the iso file for the lubuntu in the video

    • @FinFET
      @FinFET  6 หลายเดือนก่อน

      cdimage.ubuntu.com/lubuntu/releases/20.04/release/

    • @LoongBerries
      @LoongBerries 6 หลายเดือนก่อน

      @@FinFET thanks really much,you are nice guy, thank you

  • @mrsher4517
    @mrsher4517 ปีที่แล้ว +1

    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?

  • @codewithatharv5210
    @codewithatharv5210 ปีที่แล้ว +1

    That's HElpful:)))

  • @ratiemand4529
    @ratiemand4529 ปีที่แล้ว +1

    Great, useful video! By the way, I'm not sure if you are interested but I sent you an email to your business contact.