pyqtdeploy: how to set application icon for Android?

2.7k Views Asked by At

I'm following this howto to build an Android application with Python3 and Qt5. Nearly everything works fine but somehow I cannot find out how to set the application icon. In the documentation I could not find anything neither..

And just in case you know PyQtDeploy anyway.. how do I set the build mode from debug to release?

Backround:

pyqtdeploy-build creates the whole build-folder for Android (which contains all resources and AndroidManifest.xml) from scratch. Up to now I did not find a way to tell which icon to use. I would expect an option in the pyqtdeploy interface but there seems to be none..

2

There are 2 best solutions below

0
On BEST ANSWER

Edit

I have never tried it but @Fred in comment above mentioned this way in Qt Creator - maybe it will work

Edit end

PyQtDeploy is designed for Python code and resources management. App icon is an Android framework thing, so you have to do it Android way - create resource in res folder and reference it in Android manifest.

You can automate the process though - you may create simple bash script that does the thing or one more Python build script with the same purpose - it takes icon from your location moves it to res folder and alters previously generated manifest with the correct reference in form of android:icon="@drawable/your_logo_name".

At least I was doing it like that.

And as a recommendation - if you want to use Python to develop under Android(and cross platform) use Kivy it is much more mature, supportable and complete with much bigger community. It is much faster and has more libs also.

Hope it helps.

0
On

In Android you find one res name folder if not create it their and refer to manifest file .

Now you have to put icon inside a drawable folder which is inside res folder

Your path follow look like :res>>>>drawable >>>icon.png

enter image description here

In case of Kivy it become twice eaiser

Your icon path needs to be either absolute or relative to your application file. So if your directory structure looks like this:

my_app/ ├── app.py └── things └── images └── my_icon.png

class MyApp:
    def build(self):
        self.icon = r'C:\Users\you\path\to\my_app\things\images\my_icon.png'
self.icon = r'things\images\my_icon.png'