Kivy Buildozer Download

0 views
Skip to first unread message

Rory Florin

unread,
Jul 22, 2024, 8:49:40 AM7/22/24
to crostioscorvo

You can create a package for android using the python-for-android project. This page explains howto download and use it directly on your own machine (seePackaging your application into APK or AAB) oruse the Buildozer tool to automate the entire process. You can also seePackaging your application for the Kivy Launcher to run kivyprograms without compiling them.

kivy buildozer download


DOWNLOADhttps://tinurll.com/2zDr24



This creates a buildozer.spec file controlling your buildconfiguration. You should edit it appropriately with your app nameetc. You can set variables to control most or all of the parameterspassed to python-for-android.

To do this, you must run Buildozer with the release parameter(e.g. buildozer android release), or if usingpython-for-android use the --release option to build.py. Thiscreates a release AAB in the bin directory, which you mustproperly sign and zipalign.The procedure for doing this is described in the Android documentationat -signing.html#signing-manually -all the necessary tools come with the Android SDK.

Buildozer manages a file named buildozer.spec in your application directory,describing your application requirements and settings such as title, icon,included modules etc. It will use the specification file to create a packagefor Android, iOS, and more.

I built a KivyMD app, working in pycharm. When I compiled for android in buildozer in linux, it launched then crashed. This is the log stating no module named kivy._event. I noticed that there is an _event.pxd in the kivy/uix folder which was referenced by the screenmanager. Hope someone can help. Many thanks.

I researched and tried a few things. Finally I was able to overcome this. Most posts said the build had some problem. I recommend you remove the .buildozer folder in App folder in Ubuntu. Reinstall kivy, cython and all dependencies.

If you still have modulenotfounderror, I suggest you find the py file inside the kivy or kivymd folder, copy the code to another new py file with different name in the same folder as your main.py, import the class to your main.py. I suspect there are bugs during the build that some py files are not added properly.

I have some problems with an App, which I wrote with kivy an packaged with buildozer is always crashing when I try to run in on my phone. On my PC I use Ubuntu 14.10 and I don't get any error when compiling it (buildozer android debug). Then I send it on my SmartPhone and I install and run it, but it just loads and after a few seconds it crashes. By the way the kivy program is not very big. Could someone help me, please? And sorry for my bad grammar ;)

If you are using kivy and your app loads some images, then there is no problem. But if you are using some other packages like pygame to load images, it will crash. Or if you are working in some files like reading or writing a text file, it will crash. Because when you package your app with buildozer, It will move the additional files of your app (.txt, .png) to a different location. So your python file fails to find the additional files in your specified location.To solve this, do some corrections in your python file like changing the path of the additional file from the current directory of the python file to the path that is referred below.

I am using VirtualBox wih Ubuntu 20.04.1 and have installed kivymd version 0.104.2dev0 and kivy version 2.0.0. However, when I run the app on my phone alongside buildozer android logcat, it says that the kivy version is v1.11.1 and kivymd version v0.104.1. I think this is what is causing the errors in my app (and hence won't run).

It doesn't matter what version of kivy, kivymd is installed on your system. The version that gets packed with the app is downloaded while packing and it downloads the version specified in buildozer.spec file. So what you have to do is in the requirements of your buildozer.spec file instead of writing requirements=python3,kivy write requirements=python3,kivy==2.0.0. This will make sure that v2.0.0 is installed. Also, after specifying this you might have to rebuild your app by deleting .buildozer directory present in the directory where you are running buildozer. One thing to notice is that it's .buildozer not just buildozer and will be present in the directory where you initialized buildozer i.e where buildozer.spec file is. You can type rm -rf .buildozer in that directory to remove it. After that, you have to rebuild your apk using buildozer android debug deploy run

Everytime I make a little change in my main.py (just changing a small variable) and run buildozer android debug it takes me over 1 minute to build. Are my expectations too high here or is supposed to take this long time? I think my computer is alright,it is a few years old but at least I can play Fallout 4 on high settings - so I expect a bit more.

Then I changed in the requirements(buildozer spec file), the kivy version, I've put the versio 1.2.0, and it worked, however the original problem (the app crashing when interacting with MDCard) showed up again, buildozer bulds the apk if I use kivy version 1.2.0, but won't do it with kivy master (before the release of 2.2.0) and still won't work with kivy 2.2.0

This is a problem with an incompatible cython version. Try using kivy's master branch (add kivy==master to the buildozer.spec) and make sure buildozer re-downloads python-for-android by deleting the .buildozer directory in your app directory. Don't delete the one in your home dir, this contains the (much larger) Android SDK and NDK, which you don't want to have to download again.

Now if I run it on my computer in a kivy_venv, this works just fine and I have a json file in the end on my computer.However, If I compile the app with Buildozer for my android using the google-colab sheet that I found here -ways-to-convert-python-app-into-apk-77f4c9cd55af , the storing doesn't work on my phone. I always get a a KeyError (I anticipate this with Try and Except) when I want to read the data.This occurs during the app running, so it seems that the jason file on my phone is never really created.In the settings of my phone I allow storage access for the app.Any hint what I could try to get it work?Do I need to adjust the Buildozer.spec file for jason to work?The Buildozer.spec code I used is provided below.

In permissions section of your buildozer.spec file add READ_EXTERNAL_STORAGE, WRITE_EXTERNAL_STORAGE if you are saving your json file on external storage. Also, you can use android module to request storage permission so that you won't have to give it manually everytime.

The goal is to have one "buildozer.spec" file in your app directory, describingyour application requirements and settings such as title, icon, included modulesetc. Buildozer will use that spec to create a package for Android, iOS, Windows,OSX and/or Linux.

You can override the value of any buildozer.spec config token bysetting an appropriate environment variable. These are all of theform $SECTION_TOKEN, where SECTION is the config file section andTOKEN is the config token to override. Dots are replaced byunderscores.

If this is your first installing and running buildozer, you need to follow this section carefully. Applies to Buildozer 0.32. For the future version, Section 6 may help.
If you have already installed some of them, you can skip it.

I have an app that I'm trying to deploy and can't. Towards the beginning I get an 'ValueError: read of closed file' I don't know if this is related to openssl which is the step it's on when it crashes but if you understand this error I'd love some help. I'm not actually sure if anything is off on my buildozer.spec file as well... Thank you for your time.

NOTA: python-for-android y kivy-ios no son "subproyectos" de buildozer, pero los he representado como tal para entender que nosotros como desarrolladores crearemos aplicaciones con kivy, pyjnius y/o plyer y las compilaremos con buildozer tanto para iOS como para Android.

Mientras que el Framework kivy nos permite crear interfaces gráficas de usuario multiplataforma y pyinstaller permite distribuir aplicaciones creadas con Python en equipos de escritorio, buildozer hace posible su distribución en dispositivos móviles.

Por una parte buildozer utiliza python-for-android para distribuir aplicaciones en Android (no confundir kivy's python-for-android con sl4a's python-for-android), y por otra utiliza kivy-ios para distribuir aplicaciones en iOS.

En Windows mi solución fué instalar todo el entorno en el subsistema linux para poder compiar apks, y para ejecutar y testear la interfaz instalé kivy en el intérprete de python para windows.

Ya puedes utilizar kivy desde el entorno virtual kivyenv, pero antes de continuar vamos a instalar buildozer (también en el kivyenv), que nos permitirá crear un apk ejecutable a partir de nuestro código python.

Para empezar a trabajar en una aplicación deber abrir un terminal y activar tu entorno virtual para kivy. Si creaste kivyenv en el directorio $HOME () puedes activarlo desde el terminal ejecutando:

La primera vez que ejecutes buildozer -v android debiug tardará mucho tiempo en finalizar la compilación, ya que buildozer descargará de internet todo lo necesario para generar el archivo apk. Cuando lo ejecutes una vez y posteriormente modifiques la aplicación tardará mucho menos tiempo en recompilar.

760c119bf3
Reply all
Reply to author
Forward
0 new messages