Unsolved Build PySide6 application for Android
-
Hi !
I know this is a hard topic, some ideas have already been covered in the past, but maybe an update is necessary ?
I've built a PySide6 application using Qt/QML, Python, OpenCV and some other Python libraries. I am exploring the possibilities to build the current working application on Android. Here are some options that I've already seen, tried, but didn't go so deep yet:
- Buildozer (only for Kivy apps?)
- Python-for-Android (p4a)
- Pydroid
- Building everything independantly and packaging it in any way?
- Using Android Studio and/or Qt Quick Designer to automate some processes and then build directly for Android?
Most of the ways to build on Android need to go through a Linux environment, I'm using Windows Subsystem fo Linux (WSL) with a Ubuntu distribution to do so.
The heart of this post is: I'm lost in all of that, can someone clear up the process or give some cues to help unravel the ideas ?
Thanks a lot !
-
Hey There. Please Can anyone try to follow my steps here and try to compile app to android?
I have been nearly got to the point where I have been successfully ported app (probably) to android.
ITS VERY Hard cause the people who knows how to do it doesn't share information, and the process takes many steps. It is a lot of pain. And also compiling takes a lot of time...
I with the people from QT could put more effort to make documentation for python+android as future language, and c++ is not commonly used and its just old in design. None wants to write 500 lines in c++ when you can do all of that in python in 100 for ex.
So let me sum what I know:
1.There is no support for Pyside6 for android.
But still you can use PYQTDEPLOY that builds around the QT5/6 library.
All you have to do is to use your qml files and python scripts,
Generate the needed things:
Here:
https://medium.com/@Lola_Dam/packaging-pyqt-application-using-pyqtdeploy-for-both-linux-and-android-32ac7824708b
This doesn't cover everything and but its more likely you will understand most.
After you have got the pyqtdeploy setup as above:Make sure you can compile to c++ with pyqtdeploy:
There is only guide in entire internet in Russian Language that i could find (Theres no english one, use translate):
https://habr.com/ru/post/487900/Let me sum up:
2.1 Install android studio and setup it
2.2 Install qt
2.3 Install all libraries needed in Qt Creator
2.4 Setup your phone IN QT Creator ( if you are using linux on windows in VM you need to make sure you have device connected + dev options enabled)
2.5 You need to make python files + Qt design files compiled into c++ so you need to use pyqtdeploy
2.6 I have failed to compile to c++
2.7 But if you have done that you can just use the code and deploy your application easily on your phone
2.8 Before you need to check with some basic c++ application in qt creator if it ports to android (java dalvik properly)
2.9 Compiling to c++ took about 30 mins on my laptop so I cannot make tests where my compilation from python to c++ failed :(Side Notes:
When you want to use old qt like 5.12 (mentioned in tutorial above you need to download the old library of
pyqtdeploy, ! Yes you cannot download new cause it will fail to start compiling to c++...
Its can be really hard to install everything needed in qt Creator...
You need all those libraries and I have so much pain why they haven't been recognized...
So when qt creator will ask you if to install remaining automatically you should allow it to do it than download manually (lets say openssl from internet).
Please let me know if you have been able to compile to c++
Its also important for me.
If someone will be able to do that we could help whole community to provide them with easier way to understand all the process remaining than it is now. -
Hi,
To complement WikiManiac's answer, I have recently re-discovered pyqtdeploy.
Although there is documentation online about pyqtdeploy, it is hard to figure out specific steps to set up the tool.
I have decided to update the documentation and upgrade a bit the tool on my side first.
If you wish to convert your PyQt5 apps into Android apps, follow the in-depth tutorial on https://github.com/achille-martin/pyqt-crom.
There is no official support for PyQt6 in my repo yet though. So please start with PyQt5 to build prototypes and I am expected to add support for PyQt6 later.