Packaging kivy applications can be quite daunting. The documentation can be pretty confusing at times. This guide will walk you through how to pack...
For further actions, you may consider blocking this person and/or reporting abuse
i get an error if i do console= false
Error:
Hi,
If you are using pyinstaller 5.7.0, try building your app with version 5.6.2
Doesn't work... wich Versions should i Take from kivymd or kivy?
I'm using kivy==2.1.0 and kivymd==1.1.1.
Did you try running it with
--noconsole
?That is,
pyinstaller --onefile --noconsole main.py
Yes, that is the problem. With console it worked, but without console It doesn't.
Please share your spec file
The Standard Hook from the KIVYMD webside,
i think i must Import hidden modules, but i don't know how i do it correctly...
`# -- mode: python ; coding: utf-8 --
import sys
import os
from kivy_deps import sdl2, glew
from kivymd import hooks_path as kivymd_hooks_path
path = os.path.abspath("E:\Programmieren\Python\KivyMD\CreateApp")
a = Analysis(
["main.py"],
pathex=[path],
hookspath=[kivymd_hooks_path],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=None,
noarchive=False,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=None)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
*[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins)],
debug=False,
strip=False,
upx=True,
name="Main",
console=False,
)`
I used your spec file and it built the app successfully. I faced the same issue before and solved it by simply changing the version of pyinstaller I was using to version 5.6.2.
Are getting that error from building the app in this tutorial or your own application?
i did it with pyinstaller==5.6.2 and it worked!! thank you so much!!!!
You're welcome. Glad it worked
Greetings, I am currently attempting to transform my python code into an APK, however, after converting it and installing the file, it unfortunately crashes right after the kivy logo appears. I am using google collab to convert my code into APK.
Spec file
main.py
The problem you're experiencing might be due to a number of reasons, including missing dependencies, issues with your
buildozer.spec
file, or problems with the build process itself.Here are a few steps you can follow to help debug and solve the problem:
Check the Logs: After running the application and it crashes, check the logs for any error messages. On an Android device, you can view the logs by connecting the device to your computer and running
adb logcat
in a terminal. This should provide some information about why the application is crashing.Check the
Buildozer.spec
File: Ensure that all necessary requirements are mentioned in thebuildozer.spec
file. You can use the requirements field in the spec file to specify all Python modules that your app depends on.Permissions: Some functionalities might require certain permissions to be set in the
buildozer.spec
file. If your app is trying to access a feature it does not have permission for, it could cause the app to crash.Resource Files: If your application uses any resources such as images, audio files, etc., make sure that these files are being included in the APK. In your
buildozer.spec
file, thesource.include_exts
option can be used to specify the file types to include in the package.Python Version: Make sure you're using a Python version that's compatible with KivyMD.
Share the log with the errors showing, it will be helpful to debug!
That's completely nice and worked for me. thank you very much.
The question is why the above solution is not in pyinstaller by default?
You're welcome. Glad it worked for you!
Hi, your code did help me. Thank you. But can you please show me how to include a text file or a JSON file as a database. I wanna make a kivy desktop application in onefile. It's giving me error. Please help me out.
Hi,
So the best I can do is give you an example using json. You'll need two file,
main.py
andmain.kv
. I'm going to be using code from this article to demonstrate.main.kv
remains the same as in the article but inmain.py
I am going to add code to save and extract data from a json file so in the end it will look like this:When you add an item, it will be added to the listbox and saved to the json file as well. When you start the app, data is loaded from the json file and added to the listbox.
Hope that helps.
Hi, when I run pyinstaller --onefile main.py with your example, I get an empty dist folder with no executable file in it. I have python==3.10.8, kivy==2.1.0, kivymd==1.1.1.
I even tried changing pyinstaller version to 5.6.2 and the hello world program runs normally.
I am not sure how to proceed from here.
Thanks, it worked!
thanks bro it worked for me
for linux:
just skip the
kivy_deps import ..
and*[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins)],
steps